Skip to content

Commit

Permalink
USB misc: make USB device id constant
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Németh Márton authored and Greg Kroah-Hartman committed Mar 2, 2010
1 parent 9052127 commit 33b9e16
Show file tree
Hide file tree
Showing 22 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion drivers/usb/misc/adutux.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ MODULE_PARM_DESC(debug, "Debug enabled or not");
#define ADU_PRODUCT_ID 0x0064

/* table of devices that work with this driver */
static struct usb_device_id device_table [] = {
static const struct usb_device_id device_table[] = {
{ USB_DEVICE(ADU_VENDOR_ID, ADU_PRODUCT_ID) }, /* ADU100 */
{ USB_DEVICE(ADU_VENDOR_ID, ADU_PRODUCT_ID+20) }, /* ADU120 */
{ USB_DEVICE(ADU_VENDOR_ID, ADU_PRODUCT_ID+30) }, /* ADU130 */
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/appledisplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
.bInterfaceProtocol = 0x00

/* table of devices that work with this driver */
static struct usb_device_id appledisplay_table [] = {
static const struct usb_device_id appledisplay_table[] = {
{ APPLEDISPLAY_DEVICE(0x9218) },
{ APPLEDISPLAY_DEVICE(0x9219) },
{ APPLEDISPLAY_DEVICE(0x921c) },
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/berry_charge.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static int pearl_dual_mode = 1;
if (debug) \
dev_printk(KERN_DEBUG , dev , format , ## arg)

static struct usb_device_id id_table [] = {
static const struct usb_device_id id_table[] = {
{ USB_DEVICE(RIM_VENDOR, BLACKBERRY) },
{ USB_DEVICE(RIM_VENDOR, BLACKBERRY_PEARL) },
{ USB_DEVICE(RIM_VENDOR, BLACKBERRY_PEARL_DUAL) },
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/cypress_cy7c63.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@


/* table of devices that work with this driver */
static struct usb_device_id cypress_table [] = {
static const struct usb_device_id cypress_table[] = {
{ USB_DEVICE(CYPRESS_VENDOR_ID, CYPRESS_PRODUCT_ID) },
{ }
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/cytherm.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#define USB_SKEL_VENDOR_ID 0x04b4
#define USB_SKEL_PRODUCT_ID 0x0002

static struct usb_device_id id_table [] = {
static const struct usb_device_id id_table[] = {
{ USB_DEVICE(USB_SKEL_VENDOR_ID, USB_SKEL_PRODUCT_ID) },
{ }
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/emi26.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ static int emi26_load_firmware (struct usb_device *dev)
return err;
}

static struct usb_device_id id_table [] = {
static const struct usb_device_id id_table[] = {
{ USB_DEVICE(EMI26_VENDOR_ID, EMI26_PRODUCT_ID) },
{ USB_DEVICE(EMI26_VENDOR_ID, EMI26B_PRODUCT_ID) },
{ } /* Terminating entry */
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/emi62.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ static int emi62_load_firmware (struct usb_device *dev)
return err;
}

static __devinitdata struct usb_device_id id_table [] = {
static const struct usb_device_id id_table[] __devinitconst = {
{ USB_DEVICE(EMI62_VENDOR_ID, EMI62_PRODUCT_ID) },
{ } /* Terminating entry */
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/ftdi-elan.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static struct list_head ftdi_static_list;
#define USB_FTDI_ELAN_VENDOR_ID 0x0403
#define USB_FTDI_ELAN_PRODUCT_ID 0xd6ea
/* table of devices that work with this driver*/
static struct usb_device_id ftdi_elan_table[] = {
static const struct usb_device_id ftdi_elan_table[] = {
{USB_DEVICE(USB_FTDI_ELAN_VENDOR_ID, USB_FTDI_ELAN_PRODUCT_ID)},
{ /* Terminating entry */ }
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/idmouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#define ID_CHERRY 0x0010

/* device ID table */
static struct usb_device_id idmouse_table[] = {
static const struct usb_device_id idmouse_table[] = {
{USB_DEVICE(ID_SIEMENS, ID_IDMOUSE)}, /* Siemens ID Mouse (Professional) */
{USB_DEVICE(ID_SIEMENS, ID_CHERRY )}, /* Cherry FingerTIP ID Board */
{} /* terminating null entry */
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/iowarrior.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ static int usb_set_report(struct usb_interface *intf, unsigned char type,
/* driver registration */
/*---------------------*/
/* table of devices that work with this driver */
static struct usb_device_id iowarrior_ids[] = {
static const struct usb_device_id iowarrior_ids[] = {
{USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW40)},
{USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW24)},
{USB_DEVICE(USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOWPV1)},
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/isight_firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <linux/errno.h>
#include <linux/module.h>

static struct usb_device_id id_table[] = {
static const struct usb_device_id id_table[] = {
{USB_DEVICE(0x05ac, 0x8300)},
{},
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/ldusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
#endif

/* table of devices that work with this driver */
static struct usb_device_id ld_usb_table [] = {
static const struct usb_device_id ld_usb_table[] = {
{ USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY) },
{ USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY) },
{ USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MOBILECASSY) },
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/legousbtower.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ struct tower_get_version_reply {


/* table of devices that work with this driver */
static struct usb_device_id tower_table [] = {
static const struct usb_device_id tower_table[] = {
{ USB_DEVICE(LEGO_USB_TOWER_VENDOR_ID, LEGO_USB_TOWER_PRODUCT_ID) },
{ } /* Terminating entry */
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/rio500.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ static void disconnect_rio(struct usb_interface *intf)
}
}

static struct usb_device_id rio_table [] = {
static const struct usb_device_id rio_table[] = {
{ USB_DEVICE(0x0841, 1) }, /* Rio 500 */
{ } /* Terminating entry */
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/sisusbvga/sisusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -3238,7 +3238,7 @@ static void sisusb_disconnect(struct usb_interface *intf)
kref_put(&sisusb->kref, sisusb_delete);
}

static struct usb_device_id sisusb_table [] = {
static const struct usb_device_id sisusb_table[] = {
{ USB_DEVICE(0x0711, 0x0550) },
{ USB_DEVICE(0x0711, 0x0900) },
{ USB_DEVICE(0x0711, 0x0901) },
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/trancevibrator.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#define TRANCEVIBRATOR_VENDOR_ID 0x0b49 /* ASCII Corporation */
#define TRANCEVIBRATOR_PRODUCT_ID 0x064f /* Trance Vibrator */

static struct usb_device_id id_table [] = {
static const struct usb_device_id id_table[] = {
{ USB_DEVICE(TRANCEVIBRATOR_VENDOR_ID, TRANCEVIBRATOR_PRODUCT_ID) },
{ },
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/usblcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define IOCTL_GET_DRV_VERSION 2


static struct usb_device_id id_table [] = {
static const struct usb_device_id id_table[] = {
{ .idVendor = 0x10D2, .match_flags = USB_DEVICE_ID_MATCH_VENDOR, },
{ },
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/usbled.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#define PRODUCT_ID 0x1223

/* table of devices that work with this driver */
static struct usb_device_id id_table [] = {
static const struct usb_device_id id_table[] = {
{ USB_DEVICE(VENDOR_ID, PRODUCT_ID) },
{ },
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/usbsevseg.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#define MAXLEN 6

/* table of devices that work with this driver */
static struct usb_device_id id_table[] = {
static const struct usb_device_id id_table[] = {
{ USB_DEVICE(VENDOR_ID, PRODUCT_ID) },
{ },
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/usbtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -2097,7 +2097,7 @@ static struct usbtest_info generic_info = {
#endif


static struct usb_device_id id_table [] = {
static const struct usb_device_id id_table[] = {

/*-------------------------------------------------------------*/

Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/uss720.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ static void uss720_disconnect(struct usb_interface *intf)
}

/* table of cables that work through this driver */
static struct usb_device_id uss720_table [] = {
static const struct usb_device_id uss720_table[] = {
{ USB_DEVICE(0x047e, 0x1001) },
{ USB_DEVICE(0x0557, 0x2001) },
{ USB_DEVICE(0x0729, 0x1284) },
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/vstusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

#define VST_MAXBUFFER (64*1024)

static struct usb_device_id id_table[] = {
static const struct usb_device_id id_table[] = {
{ USB_DEVICE(USB_VENDOR_OCEANOPTICS, USB_PRODUCT_USB2000)},
{ USB_DEVICE(USB_VENDOR_OCEANOPTICS, USB_PRODUCT_HR4000)},
{ USB_DEVICE(USB_VENDOR_OCEANOPTICS, USB_PRODUCT_USB650)},
Expand Down

0 comments on commit 33b9e16

Please sign in to comment.