staging: make USB device id constant
PATCH 2/3 staging: make USB device id constant
From: Márton Németh <[email protected]>
The id_table field of the struct usb_device_id is constant in <linux/usb.h> so it is worth to make the initialization data also constant.
The semantic match that finds this kind of pattern is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r@
disable decl_init,const_decl_init;
identifier I1, I2, x;
@@
struct I1 {
...
const struct I2 *x;
...
};@s@
identifier r.I1, y;
identifier r.x, E;
@@
struct I1 y = {
.x = E,
};@c@
identifier r.I2;
identifier s.E;
@@
const struct I2 E[] = ... ;
@depends on !c@
identifier r.I2;
identifier s.E;
@@
+ const
struct I2 E[] = ...;
// </smpl>
---
drivers/staging/serqt_usb2/serqt_usb2.c 2010-01-08 09:53:37.000000000 +0100 renamed from drivers/staging/serqt_usb2/serqt_usb2.c 2010-01-07 19:08:46.000000000 +0100 +1 -1
@@ -126,7 +126,7 @@ static int debug; #define MODEM_CTRL 0x40 #define RS232_MODE 0x00 -static struct usb_device_id serqt_id_table[] = { +static const struct usb_device_id serqt_id_table[] = { {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_SSU100)}, {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_SSU200)}, {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_DSU100)},
drivers/staging/line6/driver.c 2010-01-08 09:56:21.000000000 +0100 renamed from drivers/staging/line6/driver.c 2010-01-07 19:08:45.000000000 +0100 +1 -1
@@ -33,7 +33,7 @@ /* table of devices that work with this driver */ -static struct usb_device_id line6_id_table[] = { +static const struct usb_device_id line6_id_table[] = { { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXT) }, { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXTLIVE) }, { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXTPRO) },
drivers/staging/winbond/wbusb.c 2010-01-08 09:58:45.000000000 +0100 renamed from drivers/staging/winbond/wbusb.c 2009-12-03 04:51:21.000000000 +0100 +1 -1
@@ -23,7 +23,7 @@ MODULE_DESCRIPTION("IS89C35 802.11bg WLA MODULE_LICENSE("GPL"); MODULE_VERSION("0.1"); -static struct usb_device_id wb35_table[] __devinitdata = { +static const struct usb_device_id wb35_table[] __devinitconst = { { USB_DEVICE(0x0416, 0x0035) }, { USB_DEVICE(0x18E8, 0x6201) }, { USB_DEVICE(0x18E8, 0x6206) },
drivers/staging/rtl8192su/r8192U_core.c 2010-01-08 10:01:12.000000000 +0100 renamed from drivers/staging/rtl8192su/r8192U_core.c 2010-01-07 19:08:46.000000000 +0100 +1 -1
@@ -110,7 +110,7 @@ u32 rt_global_debug_component = \ #define TOTAL_CAM_ENTRY 32 #define CAM_CONTENT_COUNT 8 -static struct usb_device_id rtl8192_usb_id_tbl[] = { +static const struct usb_device_id rtl8192_usb_id_tbl[] = { /* Realtek */ {USB_DEVICE(0x0bda, 0x8192)}, {USB_DEVICE(0x0bda, 0x8709)},
drivers/staging/comedi/drivers/dt9812.c 2010-01-08 10:10:15.000000000 +0100 renamed from drivers/staging/comedi/drivers/dt9812.c 2009-12-03 04:51:21.000000000 +0100 +1 -1
@@ -264,7 +264,7 @@ struct dt9812_usb_cmd { static DECLARE_MUTEX(dt9812_mutex); -static struct usb_device_id dt9812_table[] = { +static const struct usb_device_id dt9812_table[] = { {USB_DEVICE(0x0867, 0x9812)}, {} /* Terminating entry */ };
drivers/staging/comedi/drivers/usbduxfast.c 2010-01-08 10:10:57.000000000 +0100 renamed from drivers/staging/comedi/drivers/usbduxfast.c 2010-01-07 19:08:45.000000000 +0100 +1 -1
@@ -1769,7 +1769,7 @@ static struct comedi_driver driver_usbdu /* * Table with the USB-devices: just now only testing IDs */ -static struct usb_device_id usbduxfastsub_table[] = { +static const struct usb_device_id usbduxfastsub_table[] = { /* { USB_DEVICE(0x4b4, 0x8613) }, testing */ {USB_DEVICE(0x13d8, 0x0010)}, /* real ID */ {USB_DEVICE(0x13d8, 0x0011)}, /* real ID */
drivers/staging/comedi/drivers/usbdux.c 2010-01-08 10:13:48.000000000 +0100 renamed from drivers/staging/comedi/drivers/usbdux.c 2010-01-07 19:08:45.000000000 +0100 +1 -1
@@ -2833,7 +2833,7 @@ static struct comedi_driver driver_usbdu }; /* Table with the USB-devices: just now only testing IDs */ -static struct usb_device_id usbduxsub_table[] = { +static const struct usb_device_id usbduxsub_table[] = { {USB_DEVICE(0x13d8, 0x0001)}, {USB_DEVICE(0x13d8, 0x0002)}, {} /* Terminating entry */
drivers/staging/comedi/drivers/vmk80xx.c 2010-01-08 10:14:14.000000000 +0100 renamed from drivers/staging/comedi/drivers/vmk80xx.c 2010-01-07 19:08:45.000000000 +0100 +1 -1
@@ -75,7 +75,7 @@ enum { DEVICE_VMK8061 }; -static struct usb_device_id vmk80xx_id_table[] = { +static const struct usb_device_id vmk80xx_id_table[] = { {USB_DEVICE(0x10cf, 0x5500), .driver_info = DEVICE_VMK8055}, {USB_DEVICE(0x10cf, 0x5501), .driver_info = DEVICE_VMK8055}, {USB_DEVICE(0x10cf, 0x5502), .driver_info = DEVICE_VMK8055},
drivers/staging/mimio/mimio.c 2010-01-08 10:33:06.000000000 +0100 renamed from drivers/staging/mimio/mimio.c 2009-12-03 04:51:21.000000000 +0100 +1 -1
@@ -145,7 +145,7 @@ static void mimio_rx_handler(struct mimi static int mimio_tx(struct mimio *, const char *, int); static char mimio_name[] = "VirtualInk mimio-Xi"; -static struct usb_device_id mimio_table [] = { +static const struct usb_device_id mimio_table[] = { { USB_DEVICE(MIMIO_VENDOR_ID, MIMIO_PRODUCT_ID) }, { USB_DEVICE(0x0525, 0xa4a0) }, /* gadget zero firmware */ { }
drivers/staging/go7007/go7007-usb.c 2010-01-08 10:39:47.000000000 +0100 renamed from drivers/staging/go7007/go7007-usb.c 2010-01-07 19:08:45.000000000 +0100 +1 -1
@@ -444,7 +444,7 @@ static struct go7007_usb_board board_sen }, }; -static struct usb_device_id go7007_usb_id_table[] = { +static const struct usb_device_id go7007_usb_id_table[] = { { .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION | USB_DEVICE_ID_MATCH_INT_INFO,
drivers/staging/go7007/s2250-loader.c 2010-01-08 10:42:54.000000000 +0100 renamed from drivers/staging/go7007/s2250-loader.c 2010-01-07 19:08:45.000000000 +0100 +1 -1
@@ -148,7 +148,7 @@ static void s2250loader_disconnect(struc unlock_kernel(); } -static struct usb_device_id s2250loader_ids[] = { +static const struct usb_device_id s2250loader_ids[] = { {USB_DEVICE(0x1943, 0xa250)}, {} /* Terminating entry */ };
drivers/staging/otus/zdusb.c 2010-01-08 10:47:44.000000000 +0100 renamed from drivers/staging/otus/zdusb.c 2009-12-03 04:51:21.000000000 +0100 +1 -1
@@ -45,7 +45,7 @@ MODULE_LICENSE("Dual BSD/GPL"); static const char driver_name[] = "Otus"; /* table of devices that work with this driver */ -static struct usb_device_id zd1221_ids [] = { +static const struct usb_device_id zd1221_ids[] = { { USB_DEVICE(VENDOR_ATHR, PRODUCT_AR9170) }, { USB_DEVICE(VENDOR_DLINK, PRODUCT_DWA160A) }, { USB_DEVICE(VENDOR_NETGEAR, PRODUCT_WNDA3100) },
drivers/staging/rtl8192u/r8192U_core.c 2010-01-08 10:51:26.000000000 +0100 renamed from drivers/staging/rtl8192u/r8192U_core.c 2010-01-07 19:08:46.000000000 +0100 +1 -1
@@ -104,7 +104,7 @@ u32 rt_global_debug_component = \ #define TOTAL_CAM_ENTRY 32 #define CAM_CONTENT_COUNT 8 -static struct usb_device_id rtl8192_usb_id_tbl[] = { +static const struct usb_device_id rtl8192_usb_id_tbl[] = { /* Realtek */ {USB_DEVICE(0x0bda, 0x8192)}, {USB_DEVICE(0x0bda, 0x8709)},
drivers/staging/udlfb/udlfb.c 2010-01-08 10:54:45.000000000 +0100 renamed from drivers/staging/udlfb/udlfb.c 2009-12-03 04:51:21.000000000 +0100 +1 -1
@@ -112,7 +112,7 @@ static struct usb_device_id id_table [] }; */ -static struct usb_device_id id_table[] = { +static const struct usb_device_id id_table[] = { {.idVendor = 0x17e9, .match_flags = USB_DEVICE_ID_MATCH_VENDOR,}, {}, };
drivers/staging/quatech_usb2/quatech_usb2.c 2010-01-08 11:00:33.000000000 +0100 renamed from drivers/staging/quatech_usb2/quatech_usb2.c 2010-01-07 19:08:45.000000000 +0100 +1 -1
@@ -116,7 +116,7 @@ static int debug; #define FOURTHCHAR ((unsigned char *)(urb->transfer_buffer))[i + 3] #define FIFTHCHAR ((unsigned char *)(urb->transfer_buffer))[i + 4] -static struct usb_device_id quausb2_id_table[] = { +static const struct usb_device_id quausb2_id_table[] = { {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_SSU2_100)}, {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_DSU2_100)}, {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_DSU2_400)},
drivers/staging/frontier/tranzport.c 2010-01-08 11:03:26.000000000 +0100 renamed from drivers/staging/frontier/tranzport.c 2009-12-03 04:51:21.000000000 +0100 +1 -1
@@ -55,7 +55,7 @@ #endif /* table of devices that work with this driver */ -static struct usb_device_id usb_tranzport_table[] = { +static const struct usb_device_id usb_tranzport_table[] = { {USB_DEVICE(VENDOR_ID, PRODUCT_ID)}, {} /* Terminating entry */ };
drivers/staging/frontier/alphatrack.c 2010-01-08 11:03:36.000000000 +0100 renamed from drivers/staging/frontier/alphatrack.c 2009-12-03 04:51:21.000000000 +0100 +1 -1
@@ -58,7 +58,7 @@ #endif /* table of devices that work with this driver */ -static struct usb_device_id usb_alphatrack_table[] = { +static const struct usb_device_id usb_alphatrack_table[] = { {USB_DEVICE(VENDOR_ID, PRODUCT_ID)}, {} /* Terminating entry */ };
drivers/staging/asus_oled/asus_oled.c 2010-01-08 11:16:13.000000000 +0100 renamed from drivers/staging/asus_oled/asus_oled.c 2009-12-03 04:51:21.000000000 +0100 +1 -1
@@ -83,7 +83,7 @@ struct oled_dev_desc_str { }; /* table of devices that work with this driver */ -static struct usb_device_id id_table[] = { +static const struct usb_device_id id_table[] = { /* Asus G1/G2 (and variants)*/ { USB_DEVICE(0x0b05, 0x1726) }, /* Asus G50V (and possibly others - G70? G71?)*/
[email protected]
Appliedpatch staging-make-usb-device-id-constant.patch added to gregkh-2.6 tree
This is a note to let you know that I've just added the patch titled
Subject: staging: make USB device id constant
to my gregkh-2.6 tree. Its filename is
staging-make-usb-device-id-constant.patch
This tree can be found at
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/
Quoted 1 line
From [email protected] Thu Jan 14 17:09:32 2010
From: Németh Márton <[email protected]>
Date: Sun, 10 Jan 2010 00:18:34 +0100
Subject: staging: make USB device id constant
To: Greg Kroah-Hartman <[email protected]>
Cc: [email protected], LKML <[email protected]>, Julia Lawall <[email protected]>, [email protected]
Message-ID: <[email protected]>
From: Németh Márton <[email protected]>
The id_table field of the struct usb_device_id is constant in <linux/usb.h> so it is worth to make the initialization data also constant.
The semantic match that finds this kind of pattern is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r@
disable decl_init,const_decl_init;
identifier I1, I2, x;
@@
struct I1 {
...
const struct I2 *x;
...
};@s@
identifier r.I1, y;
identifier r.x, E;
@@
struct I1 y = {
.x = E,
};@c@
identifier r.I2;
identifier s.E;
@@
const struct I2 E[] = ... ;
@depends on !c@
identifier r.I2;
identifier s.E;
@@
+ const
struct I2 E[] = ...;
// </smpl>
--- drivers/staging/asus_oled/asus_oled.c | 2 +- drivers/staging/comedi/drivers/dt9812.c | 2 +- drivers/staging/comedi/drivers/usbdux.c | 2 +- drivers/staging/comedi/drivers/usbduxfast.c | 2 +- drivers/staging/comedi/drivers/vmk80xx.c | 2 +- drivers/staging/frontier/alphatrack.c | 2 +- drivers/staging/frontier/tranzport.c | 2 +- drivers/staging/go7007/go7007-usb.c | 2 +- drivers/staging/go7007/s2250-loader.c | 2 +- drivers/staging/line6/driver.c | 2 +- drivers/staging/otus/zdusb.c | 2 +- drivers/staging/quatech_usb2/quatech_usb2.c | 2 +- drivers/staging/rtl8192su/r8192U_core.c | 2 +- drivers/staging/rtl8192u/r8192U_core.c | 2 +- drivers/staging/serqt_usb2/serqt_usb2.c | 2 +- drivers/staging/winbond/wbusb.c | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-)
drivers/staging/asus_oled/asus_oled.c +1 -1
@@ -87,7 +87,7 @@ struct oled_dev_desc_str { };/* table of devices that work with this driver */ -static struct usb_device_id id_table[] = { +static const struct usb_device_id id_table[] = {/* Asus G1/G2 (and variants)*/ {USB_DEVICE (USB_VENDOR_ID_ASUS ,USB_DEVICE_ID_ASUS_LCM ) },/* Asus G50V (and possibly others - G70? G71?)*/
drivers/staging/comedi/drivers/dt9812.c +1 -1
@@ -264,7 +264,7 @@ struct dt9812_usb_cmd {static DECLARE_MUTEX (dt9812_mutex); -static struct usb_device_id dt9812_table[] = { +static const struct usb_device_id dt9812_table[] = { {USB_DEVICE (0x0867 ,0x9812 )}, {}/* Terminating entry */ };
drivers/staging/comedi/drivers/usbdux.c +1 -1
@@ -2833,7 +2833,7 @@ static struct comedi_driver driver_usbdu };/* Table with the USB-devices: just now only testing IDs */ -static struct usb_device_id usbduxsub_table[] = { +static const struct usb_device_id usbduxsub_table[] = { {USB_DEVICE (0x13d8 ,0x0001 )}, {USB_DEVICE (0x13d8 ,0x0002 )}, {}/* Terminating entry */
drivers/staging/comedi/drivers/usbduxfast.c +1 -1
@@ -1769,7 +1769,7 @@ static struct comedi_driver driver_usbdu/* * Table with the USB-devices: just now only testing IDs */ -static struct usb_device_id usbduxfastsub_table[] = { +static const struct usb_device_id usbduxfastsub_table[] = {/* { USB_DEVICE(0x4b4, 0x8613) }, testing */ {USB_DEVICE (0x13d8 ,0x0010 )},/* real ID */ {USB_DEVICE (0x13d8 ,0x0011 )},/* real ID */
drivers/staging/comedi/drivers/vmk80xx.c +1 -1
@@ -75,7 +75,7 @@ enum {DEVICE_VMK8061 }; -static struct usb_device_id vmk80xx_id_table[] = { +static const struct usb_device_id vmk80xx_id_table[] = { {USB_DEVICE (0x10cf ,0x5500 ), .driver_info =DEVICE_VMK8055 }, {USB_DEVICE (0x10cf ,0x5501 ), .driver_info =DEVICE_VMK8055 }, {USB_DEVICE (0x10cf ,0x5502 ), .driver_info =DEVICE_VMK8055 },
drivers/staging/frontier/alphatrack.c +1 -1
@@ -58,7 +58,7 @@#endif /* table of devices that work with this driver */ -static struct usb_device_id usb_alphatrack_table[] = { +static const struct usb_device_id usb_alphatrack_table[] = { {USB_DEVICE (VENDOR_ID ,PRODUCT_ID )}, {}/* Terminating entry */ };
drivers/staging/frontier/tranzport.c +1 -1
@@ -55,7 +55,7 @@#endif /* table of devices that work with this driver */ -static struct usb_device_id usb_tranzport_table[] = { +static const struct usb_device_id usb_tranzport_table[] = { {USB_DEVICE (VENDOR_ID ,PRODUCT_ID )}, {}/* Terminating entry */ };
drivers/staging/go7007/go7007-usb.c +1 -1
@@ -444,7 +444,7 @@ static struct go7007_usb_board board_sen }, }; -static struct usb_device_id go7007_usb_id_table[] = { +static const struct usb_device_id go7007_usb_id_table[] = { { .match_flags =USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION |USB_DEVICE_ID_MATCH_INT_INFO ,
drivers/staging/go7007/s2250-loader.c +1 -1
@@ -148,7 +148,7 @@ static void s2250loader_disconnect(strucunlock_kernel (); } -static struct usb_device_id s2250loader_ids[] = { +static const struct usb_device_id s2250loader_ids[] = { {USB_DEVICE (0x1943 ,0xa250 )}, {}/* Terminating entry */ };
drivers/staging/line6/driver.c +1 -1
@@ -33,7 +33,7 @@/* table of devices that work with this driver */ -static struct usb_device_id line6_id_table[] = { +static const struct usb_device_id line6_id_table[] = { {USB_DEVICE (LINE6_VENDOR_ID ,LINE6_DEVID_BASSPODXT ) }, {USB_DEVICE (LINE6_VENDOR_ID ,LINE6_DEVID_BASSPODXTLIVE ) }, {USB_DEVICE (LINE6_VENDOR_ID ,LINE6_DEVID_BASSPODXTPRO ) },
drivers/staging/otus/zdusb.c +1 -1
@@ -45,7 +45,7 @@ MODULE_LICENSE("Dual BSD/GPL");static const char driver_name[] ="Otus" ;/* table of devices that work with this driver */ -static struct usb_device_id zd1221_ids [] = { +static const struct usb_device_id zd1221_ids[] = { {USB_DEVICE (VENDOR_ATHR ,PRODUCT_AR9170 ) }, {USB_DEVICE (VENDOR_DLINK ,PRODUCT_DWA160A ) }, {USB_DEVICE (VENDOR_NETGEAR ,PRODUCT_WNDA3100 ) },
drivers/staging/quatech_usb2/quatech_usb2.c +1 -1
@@ -116,7 +116,7 @@ static int debug;#define FOURTHCHAR ((unsigned char *)(urb->transfer_buffer))[i + 3]#define FIFTHCHAR ((unsigned char *)(urb->transfer_buffer))[i + 4] -static struct usb_device_id quausb2_id_table[] = { +static const struct usb_device_id quausb2_id_table[] = { {USB_DEVICE (USB_VENDOR_ID_QUATECH ,QUATECH_SSU2_100 )}, {USB_DEVICE (USB_VENDOR_ID_QUATECH ,QUATECH_DSU2_100 )}, {USB_DEVICE (USB_VENDOR_ID_QUATECH ,QUATECH_DSU2_400 )},
drivers/staging/rtl8192su/r8192U_core.c +1 -1
@@ -110,7 +110,7 @@ u32 rt_global_debug_component = \#define TOTAL_CAM_ENTRY 32#define CAM_CONTENT_COUNT 8 -static struct usb_device_id rtl8192_usb_id_tbl[] = { +static const struct usb_device_id rtl8192_usb_id_tbl[] = {/* Realtek */ {USB_DEVICE (0x0bda ,0x8192 )}, {USB_DEVICE (0x0bda ,0x8709 )},
drivers/staging/rtl8192u/r8192U_core.c +1 -1
@@ -104,7 +104,7 @@ u32 rt_global_debug_component = \#define TOTAL_CAM_ENTRY 32#define CAM_CONTENT_COUNT 8 -static struct usb_device_id rtl8192_usb_id_tbl[] = { +static const struct usb_device_id rtl8192_usb_id_tbl[] = {/* Realtek */ {USB_DEVICE (0x0bda ,0x8192 )}, {USB_DEVICE (0x0bda ,0x8709 )},
drivers/staging/serqt_usb2/serqt_usb2.c +1 -1
@@ -126,7 +126,7 @@ static int debug;#define MODEM_CTRL 0x40#define RS232_MODE 0x00 -static struct usb_device_id serqt_id_table[] = { +static const struct usb_device_id serqt_id_table[] = { {USB_DEVICE (USB_VENDOR_ID_QUATECH ,QUATECH_SSU100 )}, {USB_DEVICE (USB_VENDOR_ID_QUATECH ,QUATECH_SSU200 )}, {USB_DEVICE (USB_VENDOR_ID_QUATECH ,QUATECH_DSU100 )},
drivers/staging/winbond/wbusb.c +1 -1
@@ -23,7 +23,7 @@ MODULE_DESCRIPTION("IS89C35 802.11bg WLAMODULE_LICENSE ("GPL" );MODULE_VERSION ("0.1" ); -static struct usb_device_id wb35_table[]__devinitdata = { +static const struct usb_device_id wb35_table[]__devinitconst = { {USB_DEVICE (0x0416 ,0x0035 ) }, {USB_DEVICE (0x18E8 ,0x6201 ) }, {USB_DEVICE (0x18E8 ,0x6206 ) },