Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a457732b authored by Németh Márton's avatar Németh Márton Committed by Greg Kroah-Hartman
Browse files

staging: 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: default avatarNémeth Márton <nm127@freemail.hu>
Cc: Julia Lawall <julia@diku.dk>
Cc: cocci@diku.dk
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 13ac58da
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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?)*/
+1 −1
Original line number Diff line number Diff line
@@ -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 */
};
+1 −1
Original line number Diff line number Diff line
@@ -2833,7 +2833,7 @@ static struct comedi_driver driver_usbdux = {
};

/* 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 */
+1 −1
Original line number Diff line number Diff line
@@ -1769,7 +1769,7 @@ static struct comedi_driver driver_usbduxfast = {
/*
 * 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 */
+1 −1
Original line number Diff line number Diff line
@@ -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},
Loading