Commit 33b9e16243fd69493be3ddda7be73226c8be586a
Committed by
Greg Kroah-Hartman
1 parent
9052127f63
Exists in
master
and in
7 other branches
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>
Showing 22 changed files with 22 additions and 22 deletions Side-by-side Diff
- drivers/usb/misc/adutux.c
- drivers/usb/misc/appledisplay.c
- drivers/usb/misc/berry_charge.c
- drivers/usb/misc/cypress_cy7c63.c
- drivers/usb/misc/cytherm.c
- drivers/usb/misc/emi26.c
- drivers/usb/misc/emi62.c
- drivers/usb/misc/ftdi-elan.c
- drivers/usb/misc/idmouse.c
- drivers/usb/misc/iowarrior.c
- drivers/usb/misc/isight_firmware.c
- drivers/usb/misc/ldusb.c
- drivers/usb/misc/legousbtower.c
- drivers/usb/misc/rio500.c
- drivers/usb/misc/sisusbvga/sisusb.c
- drivers/usb/misc/trancevibrator.c
- drivers/usb/misc/usblcd.c
- drivers/usb/misc/usbled.c
- drivers/usb/misc/usbsevseg.c
- drivers/usb/misc/usbtest.c
- drivers/usb/misc/uss720.c
- drivers/usb/misc/vstusb.c
drivers/usb/misc/adutux.c
... | ... | @@ -56,7 +56,7 @@ |
56 | 56 | #define ADU_PRODUCT_ID 0x0064 |
57 | 57 | |
58 | 58 | /* 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[] = { | |
60 | 60 | { USB_DEVICE(ADU_VENDOR_ID, ADU_PRODUCT_ID) }, /* ADU100 */ |
61 | 61 | { USB_DEVICE(ADU_VENDOR_ID, ADU_PRODUCT_ID+20) }, /* ADU120 */ |
62 | 62 | { USB_DEVICE(ADU_VENDOR_ID, ADU_PRODUCT_ID+30) }, /* ADU130 */ |
drivers/usb/misc/appledisplay.c
... | ... | @@ -57,7 +57,7 @@ |
57 | 57 | .bInterfaceProtocol = 0x00 |
58 | 58 | |
59 | 59 | /* 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[] = { | |
61 | 61 | { APPLEDISPLAY_DEVICE(0x9218) }, |
62 | 62 | { APPLEDISPLAY_DEVICE(0x9219) }, |
63 | 63 | { APPLEDISPLAY_DEVICE(0x921c) }, |
drivers/usb/misc/berry_charge.c
... | ... | @@ -39,7 +39,7 @@ |
39 | 39 | if (debug) \ |
40 | 40 | dev_printk(KERN_DEBUG , dev , format , ## arg) |
41 | 41 | |
42 | -static struct usb_device_id id_table [] = { | |
42 | +static const struct usb_device_id id_table[] = { | |
43 | 43 | { USB_DEVICE(RIM_VENDOR, BLACKBERRY) }, |
44 | 44 | { USB_DEVICE(RIM_VENDOR, BLACKBERRY_PEARL) }, |
45 | 45 | { USB_DEVICE(RIM_VENDOR, BLACKBERRY_PEARL_DUAL) }, |
drivers/usb/misc/cypress_cy7c63.c
drivers/usb/misc/cytherm.c
drivers/usb/misc/emi26.c
... | ... | @@ -245,7 +245,7 @@ |
245 | 245 | return err; |
246 | 246 | } |
247 | 247 | |
248 | -static struct usb_device_id id_table [] = { | |
248 | +static const struct usb_device_id id_table[] = { | |
249 | 249 | { USB_DEVICE(EMI26_VENDOR_ID, EMI26_PRODUCT_ID) }, |
250 | 250 | { USB_DEVICE(EMI26_VENDOR_ID, EMI26B_PRODUCT_ID) }, |
251 | 251 | { } /* Terminating entry */ |
drivers/usb/misc/emi62.c
... | ... | @@ -259,7 +259,7 @@ |
259 | 259 | return err; |
260 | 260 | } |
261 | 261 | |
262 | -static __devinitdata struct usb_device_id id_table [] = { | |
262 | +static const struct usb_device_id id_table[] __devinitconst = { | |
263 | 263 | { USB_DEVICE(EMI62_VENDOR_ID, EMI62_PRODUCT_ID) }, |
264 | 264 | { } /* Terminating entry */ |
265 | 265 | }; |
drivers/usb/misc/ftdi-elan.c
... | ... | @@ -86,7 +86,7 @@ |
86 | 86 | #define USB_FTDI_ELAN_VENDOR_ID 0x0403 |
87 | 87 | #define USB_FTDI_ELAN_PRODUCT_ID 0xd6ea |
88 | 88 | /* 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[] = { | |
90 | 90 | {USB_DEVICE(USB_FTDI_ELAN_VENDOR_ID, USB_FTDI_ELAN_PRODUCT_ID)}, |
91 | 91 | { /* Terminating entry */ } |
92 | 92 | }; |
drivers/usb/misc/idmouse.c
... | ... | @@ -48,7 +48,7 @@ |
48 | 48 | #define ID_CHERRY 0x0010 |
49 | 49 | |
50 | 50 | /* device ID table */ |
51 | -static struct usb_device_id idmouse_table[] = { | |
51 | +static const struct usb_device_id idmouse_table[] = { | |
52 | 52 | {USB_DEVICE(ID_SIEMENS, ID_IDMOUSE)}, /* Siemens ID Mouse (Professional) */ |
53 | 53 | {USB_DEVICE(ID_SIEMENS, ID_CHERRY )}, /* Cherry FingerTIP ID Board */ |
54 | 54 | {} /* terminating null entry */ |
drivers/usb/misc/iowarrior.c
... | ... | @@ -139,7 +139,7 @@ |
139 | 139 | /* driver registration */ |
140 | 140 | /*---------------------*/ |
141 | 141 | /* 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[] = { | |
143 | 143 | {USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW40)}, |
144 | 144 | {USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW24)}, |
145 | 145 | {USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOWPV1)}, |
drivers/usb/misc/isight_firmware.c
drivers/usb/misc/ldusb.c
... | ... | @@ -69,7 +69,7 @@ |
69 | 69 | #endif |
70 | 70 | |
71 | 71 | /* table of devices that work with this driver */ |
72 | -static struct usb_device_id ld_usb_table [] = { | |
72 | +static const struct usb_device_id ld_usb_table[] = { | |
73 | 73 | { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY) }, |
74 | 74 | { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY) }, |
75 | 75 | { USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOBILECASSY) }, |
drivers/usb/misc/legousbtower.c
... | ... | @@ -192,7 +192,7 @@ |
192 | 192 | |
193 | 193 | |
194 | 194 | /* table of devices that work with this driver */ |
195 | -static struct usb_device_id tower_table [] = { | |
195 | +static const struct usb_device_id tower_table[] = { | |
196 | 196 | { USB_DEVICE(LEGO_USB_TOWER_VENDOR_ID, LEGO_USB_TOWER_PRODUCT_ID) }, |
197 | 197 | { } /* Terminating entry */ |
198 | 198 | }; |
drivers/usb/misc/rio500.c
drivers/usb/misc/sisusbvga/sisusb.c
... | ... | @@ -3238,7 +3238,7 @@ |
3238 | 3238 | kref_put(&sisusb->kref, sisusb_delete); |
3239 | 3239 | } |
3240 | 3240 | |
3241 | -static struct usb_device_id sisusb_table [] = { | |
3241 | +static const struct usb_device_id sisusb_table[] = { | |
3242 | 3242 | { USB_DEVICE(0x0711, 0x0550) }, |
3243 | 3243 | { USB_DEVICE(0x0711, 0x0900) }, |
3244 | 3244 | { USB_DEVICE(0x0711, 0x0901) }, |
drivers/usb/misc/trancevibrator.c
... | ... | @@ -33,7 +33,7 @@ |
33 | 33 | #define TRANCEVIBRATOR_VENDOR_ID 0x0b49 /* ASCII Corporation */ |
34 | 34 | #define TRANCEVIBRATOR_PRODUCT_ID 0x064f /* Trance Vibrator */ |
35 | 35 | |
36 | -static struct usb_device_id id_table [] = { | |
36 | +static const struct usb_device_id id_table[] = { | |
37 | 37 | { USB_DEVICE(TRANCEVIBRATOR_VENDOR_ID, TRANCEVIBRATOR_PRODUCT_ID) }, |
38 | 38 | { }, |
39 | 39 | }; |
drivers/usb/misc/usblcd.c
drivers/usb/misc/usbled.c
drivers/usb/misc/usbsevseg.c
drivers/usb/misc/usbtest.c
drivers/usb/misc/uss720.c
... | ... | @@ -770,7 +770,7 @@ |
770 | 770 | } |
771 | 771 | |
772 | 772 | /* table of cables that work through this driver */ |
773 | -static struct usb_device_id uss720_table [] = { | |
773 | +static const struct usb_device_id uss720_table[] = { | |
774 | 774 | { USB_DEVICE(0x047e, 0x1001) }, |
775 | 775 | { USB_DEVICE(0x0557, 0x2001) }, |
776 | 776 | { USB_DEVICE(0x0729, 0x1284) }, |
drivers/usb/misc/vstusb.c
... | ... | @@ -61,7 +61,7 @@ |
61 | 61 | |
62 | 62 | #define VST_MAXBUFFER (64*1024) |
63 | 63 | |
64 | -static struct usb_device_id id_table[] = { | |
64 | +static const struct usb_device_id id_table[] = { | |
65 | 65 | { USB_DEVICE(USB_VENDOR_OCEANOPTICS, USB_PRODUCT_USB2000)}, |
66 | 66 | { USB_DEVICE(USB_VENDOR_OCEANOPTICS, USB_PRODUCT_HR4000)}, |
67 | 67 | { USB_DEVICE(USB_VENDOR_OCEANOPTICS, USB_PRODUCT_USB650)}, |