Skip to content

Commit 33b9e16

Browse files
nmarci1gregkh
authored andcommitted
USB misc: make USB device id constant
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> Signed-off-by: Németh Márton <nm127@freemail.hu> Cc: Julia Lawall <julia@diku.dk> Cc: cocci@diku.dk Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 9052127 commit 33b9e16

22 files changed

Lines changed: 22 additions & 22 deletions

‎drivers/usb/misc/adutux.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ MODULE_PARM_DESC(debug, "Debug enabled or not");
5656
#define ADU_PRODUCT_ID 0x0064
5757

5858
/* table of devices that work with this driver */
59-
static struct usb_device_id device_table [] = {
59+
static const struct usb_device_id device_table[] = {
6060
{ USB_DEVICE(ADU_VENDOR_ID, ADU_PRODUCT_ID) }, /* ADU100 */
6161
{ USB_DEVICE(ADU_VENDOR_ID, ADU_PRODUCT_ID+20) }, /* ADU120 */
6262
{ USB_DEVICE(ADU_VENDOR_ID, ADU_PRODUCT_ID+30) }, /* ADU130 */

‎drivers/usb/misc/appledisplay.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
.bInterfaceProtocol = 0x00
5858

5959
/* table of devices that work with this driver */
60-
static struct usb_device_id appledisplay_table [] = {
60+
static const struct usb_device_id appledisplay_table[] = {
6161
{ APPLEDISPLAY_DEVICE(0x9218) },
6262
{ APPLEDISPLAY_DEVICE(0x9219) },
6363
{ APPLEDISPLAY_DEVICE(0x921c) },

‎drivers/usb/misc/berry_charge.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static int pearl_dual_mode = 1;
3939
if (debug) \
4040
dev_printk(KERN_DEBUG , dev , format , ## arg)
4141

42-
static struct usb_device_id id_table [] = {
42+
static const struct usb_device_id id_table[] = {
4343
{ USB_DEVICE(RIM_VENDOR, BLACKBERRY) },
4444
{ USB_DEVICE(RIM_VENDOR, BLACKBERRY_PEARL) },
4545
{ USB_DEVICE(RIM_VENDOR, BLACKBERRY_PEARL_DUAL) },

‎drivers/usb/misc/cypress_cy7c63.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757

5858
/* table of devices that work with this driver */
59-
static struct usb_device_id cypress_table [] = {
59+
static const struct usb_device_id cypress_table[] = {
6060
{ USB_DEVICE(CYPRESS_VENDOR_ID, CYPRESS_PRODUCT_ID) },
6161
{ }
6262
};

‎drivers/usb/misc/cytherm.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#define USB_SKEL_VENDOR_ID 0x04b4
2828
#define USB_SKEL_PRODUCT_ID 0x0002
2929

30-
static struct usb_device_id id_table [] = {
30+
static const struct usb_device_id id_table[] = {
3131
{ USB_DEVICE(USB_SKEL_VENDOR_ID, USB_SKEL_PRODUCT_ID) },
3232
{ }
3333
};

‎drivers/usb/misc/emi26.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ static int emi26_load_firmware (struct usb_device *dev)
245245
return err;
246246
}
247247

248-
static struct usb_device_id id_table [] = {
248+
static const struct usb_device_id id_table[] = {
249249
{ USB_DEVICE(EMI26_VENDOR_ID, EMI26_PRODUCT_ID) },
250250
{ USB_DEVICE(EMI26_VENDOR_ID, EMI26B_PRODUCT_ID) },
251251
{ } /* Terminating entry */

‎drivers/usb/misc/emi62.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ static int emi62_load_firmware (struct usb_device *dev)
259259
return err;
260260
}
261261

262-
static __devinitdata struct usb_device_id id_table [] = {
262+
static const struct usb_device_id id_table[] __devinitconst = {
263263
{ USB_DEVICE(EMI62_VENDOR_ID, EMI62_PRODUCT_ID) },
264264
{ } /* Terminating entry */
265265
};

‎drivers/usb/misc/ftdi-elan.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static struct list_head ftdi_static_list;
8686
#define USB_FTDI_ELAN_VENDOR_ID 0x0403
8787
#define USB_FTDI_ELAN_PRODUCT_ID 0xd6ea
8888
/* table of devices that work with this driver*/
89-
static struct usb_device_id ftdi_elan_table[] = {
89+
static const struct usb_device_id ftdi_elan_table[] = {
9090
{USB_DEVICE(USB_FTDI_ELAN_VENDOR_ID, USB_FTDI_ELAN_PRODUCT_ID)},
9191
{ /* Terminating entry */ }
9292
};

‎drivers/usb/misc/idmouse.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
#define ID_CHERRY 0x0010
4949

5050
/* device ID table */
51-
static struct usb_device_id idmouse_table[] = {
51+
static const struct usb_device_id idmouse_table[] = {
5252
{USB_DEVICE(ID_SIEMENS, ID_IDMOUSE)}, /* Siemens ID Mouse (Professional) */
5353
{USB_DEVICE(ID_SIEMENS, ID_CHERRY )}, /* Cherry FingerTIP ID Board */
5454
{} /* terminating null entry */

‎drivers/usb/misc/iowarrior.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ static int usb_set_report(struct usb_interface *intf, unsigned char type,
139139
/* driver registration */
140140
/*---------------------*/
141141
/* table of devices that work with this driver */
142-
static struct usb_device_id iowarrior_ids[] = {
142+
static const struct usb_device_id iowarrior_ids[] = {
143143
{USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW40)},
144144
{USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW24)},
145145
{USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOWPV1)},

0 commit comments

Comments
 (0)