Re: [PATCH 2/2] Remove static sizing of usb_device_id arrays

2013-07-25 Thread Anders Hammarquist
In a message of Wed, 24 Jul 2013 15:52:08 -0700, Greg KH writes:
On Sat, Jun 22, 2013 at 08:55:59PM +0200, Anders Hammarquist wrote:
 
 Signed-off-by: Anders Hammarquist i...@iko.pp.se
 ---
  drivers/usb/serial/ti_usb_3410_5052.c |   29 -
  1 file changed, 24 insertions(+), 5 deletions(-)

This patch, and your previous one, are no longer needed, right?

They are needed until the module params for adding vendor and
product ids are removed, and it sounded like the consensus was
to keep them for a while.

/Anders
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/2] *** SUBJECT HERE ***

2013-07-01 Thread Anders Hammarquist
In a message of Fri, 28 Jun 2013 12:23:33 +0200, Johan Hovold writes:
 I did a quick check of adding the device id though sysfs, and although
 it partly works, it doesn't find the correct firmware (it ends up trying
 to load 5052 firmware for a 3410 device. Looking at the code it seems
 (struct ti_device) td_is_3410 isn't set properly.)

Turns out that the drivers device-type detection has never worked with
the dynamic id interface (all devices were detected as 2-port devices).

I'm responding to this mail with a fix. Care to give it a try?

Yes, this works fine. 

/Anders
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/2] *** SUBJECT HERE ***

2013-06-27 Thread Anders Hammarquist
In a message of Wed, 26 Jun 2013 12:39:24 +0200, Johan Hovold writes:
On Wed, Jun 26, 2013 at 10:29:59AM +0200, Anders Hammarquist wrote:
 In a message of Tue, 25 Jun 2013 16:39:11 -0700, Greg KH writes:
  Indeed. I'd already had some (failed) thoughts about how to handle it
  nicely. Now I've had another think through, and I have something which
  deals with it and at least complains if TI_EXTRA_VID_PID_COUNT is changed
  without changing the initializer. Patch 2/2
 
 Why don't we just drop the extra id thing entirely?  The usb-serial
 subsystem handles new device ids being added dynamically from sysfs for
 a long time now.  Removing this module option would clean up the code a
 lot, and prevent these errors from ever happening again.
 
 Aha, yes, I'm all for that (had I only known I'd have done that to start
 with). I'll look in to it.

I already have a few patches here (part of a larger 3.11 clean-up series)
which removes the vid/pid module parameters from all usb-serial modules
including ti_usb_3410_5052.

I hope to be able to submit the whole series a later tonight, but here's
the ti_usb_3410_5052 part if anyone's interested.

I did a quick check of adding the device id though sysfs, and although
it partly works, it doesn't find the correct firmware (it ends up trying
to load 5052 firmware for a 3410 device. Looking at the code it seems
(struct ti_device) td_is_3410 isn't set properly.)

I can take a stab at fixing it in the next few days.

/Anders
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/2] *** SUBJECT HERE ***

2013-06-26 Thread Anders Hammarquist
In a message of Tue, 25 Jun 2013 16:39:11 -0700, Greg KH writes:
 Indeed. I'd already had some (failed) thoughts about how to handle it
 nicely. Now I've had another think through, and I have something which
 deals with it and at least complains if TI_EXTRA_VID_PID_COUNT is changed
 without changing the initializer. Patch 2/2

Why don't we just drop the extra id thing entirely?  The usb-serial
subsystem handles new device ids being added dynamically from sysfs for
a long time now.  Removing this module option would clean up the code a
lot, and prevent these errors from ever happening again.

Aha, yes, I'm all for that (had I only known I'd have done that to start
with). I'll look in to it.

/Anders
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/2] *** SUBJECT HERE ***

2013-06-22 Thread Anders Hammarquist
In a message of Fri, 21 Jun 2013 16:56:03 -0700, Greg KH writes:
Please resend this in a format that I can apply it in (i.e. one that
does not require me to edit it by hand...)

After more fighting with git, I belive I now made it spit out what I
wanted. Patch 1/2 ahead.

 -static struct usb_device_id ti_id_table_3410[15+TI_EXTRA_VID_PID_COUNT+1] = 
 {
 +static struct usb_device_id ti_id_table_3410[16+TI_EXTRA_VID_PID_COUNT+1] = 
 {

That's a mess, why have it be a static array at all?  Just include an
empty one at the end.

Indeed. I'd already had some (failed) thoughts about how to handle it
nicely. Now I've had another think through, and I have something which
deals with it and at least complains if TI_EXTRA_VID_PID_COUNT is changed
without changing the initializer. Patch 2/2

/Anders
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] Remove static sizing of usb_device_id arrays

2013-06-22 Thread Anders Hammarquist

Signed-off-by: Anders Hammarquist i...@iko.pp.se
---
 drivers/usb/serial/ti_usb_3410_5052.c |   29 -
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/serial/ti_usb_3410_5052.c 
b/drivers/usb/serial/ti_usb_3410_5052.c
index 26c1161..441c788 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -60,7 +60,20 @@
 #define TI_READ_URB_STOPPED2
 
 #define TI_EXTRA_VID_PID_COUNT 5
-
+#define TI_EXTRA_VID_PID_INITALIZER {0}, {0}, {0}, {0}, {0}
+
+/* Check that TI_EXTRA_VID_PID_COUNT and TI_EXTRA_VID_PID_INITALIZER match.
+   On x86, this wastes one byte of __init space to provide a compile-time
+   error if you do not match up the definitions of TI_EXTRA_VID_PID_COUNT and
+   TI_EXTRA_VID_PID_INITIALIZER. Expect space waste up to sizeof(void *) for
+   other architectures. */
+__init void __ti_extra_vid_pid_test(void)
+{
+   struct { char a; } ti_extra_vid_pid_initializer[] =
+   { TI_EXTRA_VID_PID_INITALIZER };
+   BUILD_BUG_ON(ARRAY_SIZE(ti_extra_vid_pid_initializer) !=
+   TI_EXTRA_VID_PID_COUNT);
+}
 
 /* Structures */
 
@@ -158,7 +171,7 @@ static unsigned int product_5052_count;
 /* the array dimension is the number of default entries plus */
 /* TI_EXTRA_VID_PID_COUNT user defined entries plus 1 terminating */
 /* null entry */
-static struct usb_device_id ti_id_table_3410[16+TI_EXTRA_VID_PID_COUNT+1] = {
+static struct usb_device_id ti_id_table_3410[] = {
{ USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
{ USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
{ USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) },
@@ -175,16 +188,20 @@ static struct usb_device_id 
ti_id_table_3410[16+TI_EXTRA_VID_PID_COUNT+1] = {
{ USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STEREO_PLUG_PRODUCT_ID) },
{ USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_PRODUCT_ID) },
{ USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) },
+   TI_EXTRA_VID_PID_INITALIZER, /* space for run-time VID-PID pairs */
+   {0} /* End of array maker */
 };
 
-static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = {
+static struct usb_device_id ti_id_table_5052[] = {
{ USB_DEVICE(TI_VENDOR_ID, TI_5052_BOOT_PRODUCT_ID) },
{ USB_DEVICE(TI_VENDOR_ID, TI_5152_BOOT_PRODUCT_ID) },
{ USB_DEVICE(TI_VENDOR_ID, TI_5052_EEPROM_PRODUCT_ID) },
{ USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) },
+   TI_EXTRA_VID_PID_INITALIZER, /* space for run-time VID-PID pairs */
+   {0} /* End of array maker */
 };
 
-static struct usb_device_id 
ti_id_table_combined[20+2*TI_EXTRA_VID_PID_COUNT+1] = {
+static struct usb_device_id ti_id_table_combined[] = {
{ USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
{ USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
{ USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) },
@@ -205,7 +222,9 @@ static struct usb_device_id 
ti_id_table_combined[20+2*TI_EXTRA_VID_PID_COUNT+1]
{ USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STEREO_PLUG_PRODUCT_ID) },
{ USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_PRODUCT_ID) },
{ USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) },
-   { }
+   TI_EXTRA_VID_PID_INITALIZER, /* space for run-time VID-PID pairs */
+   TI_EXTRA_VID_PID_INITALIZER, /* Two needed, combined 3410 and 5052 */
+   {0} /* End of array maker */
 };
 
 static struct usb_serial_driver ti_1port_device = {
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] * Remove unused and overly generic ABBOTT_PRODUCT_ID * Fix sizes of statically sized usb_debvice_id tables

2013-06-22 Thread Anders Hammarquist

Signed-off-by: Anders Hammarquist i...@iko.pp.se
---
 drivers/usb/serial/ti_usb_3410_5052.c |   11 ++-
 drivers/usb/serial/ti_usb_3410_5052.h |5 ++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/serial/ti_usb_3410_5052.c 
b/drivers/usb/serial/ti_usb_3410_5052.c
index e581c25..26c1161 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -158,7 +158,7 @@ static unsigned int product_5052_count;
 /* the array dimension is the number of default entries plus */
 /* TI_EXTRA_VID_PID_COUNT user defined entries plus 1 terminating */
 /* null entry */
-static struct usb_device_id ti_id_table_3410[15+TI_EXTRA_VID_PID_COUNT+1] = {
+static struct usb_device_id ti_id_table_3410[16+TI_EXTRA_VID_PID_COUNT+1] = {
{ USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
{ USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
{ USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) },
@@ -172,8 +172,8 @@ static struct usb_device_id 
ti_id_table_3410[15+TI_EXTRA_VID_PID_COUNT+1] = {
{ USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) },
{ USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
{ USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
-   { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STEREO_PLUG_ID) },
-   { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_ID) },
+   { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STEREO_PLUG_PRODUCT_ID) },
+   { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_PRODUCT_ID) },
{ USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) },
 };
 
@@ -184,7 +184,7 @@ static struct usb_device_id 
ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = {
{ USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) },
 };
 
-static struct usb_device_id 
ti_id_table_combined[19+2*TI_EXTRA_VID_PID_COUNT+1] = {
+static struct usb_device_id 
ti_id_table_combined[20+2*TI_EXTRA_VID_PID_COUNT+1] = {
{ USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
{ USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
{ USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) },
@@ -202,7 +202,8 @@ static struct usb_device_id 
ti_id_table_combined[19+2*TI_EXTRA_VID_PID_COUNT+1]
{ USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) },
{ USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
{ USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
-   { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) },
+   { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STEREO_PLUG_PRODUCT_ID) },
+   { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_PRODUCT_ID) },
{ USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) },
{ }
 };
diff --git a/drivers/usb/serial/ti_usb_3410_5052.h 
b/drivers/usb/serial/ti_usb_3410_5052.h
index 4a2423e..d3ff470 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.h
+++ b/drivers/usb/serial/ti_usb_3410_5052.h
@@ -52,9 +52,8 @@
 
 /* Abbott Diabetics vendor and product ids */
 #define ABBOTT_VENDOR_ID   0x1a61
-#define ABBOTT_STEREO_PLUG_ID  0x3410
-#define ABBOTT_PRODUCT_ID  ABBOTT_STEREO_PLUG_ID
-#define ABBOTT_STRIP_PORT_ID   0x3420
+#define ABBOTT_STEREO_PLUG_PRODUCT_ID  0x3410
+#define ABBOTT_STRIP_PORT_PRODUCT_ID   0x3420
 
 /* Commands */
 #define TI_GET_VERSION 0x01
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html