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 2/2] Remove static sizing of usb_device_id arrays

2013-07-24 Thread Greg KH
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?

thanks,

greg k-h
--
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