]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
staging: make USB device id constant
authorNémeth Márton <nm127@freemail.hu>
Sat, 9 Jan 2010 23:18:34 +0000 (00:18 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 4 Mar 2010 00:42:42 +0000 (16:42 -0800)
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>
16 files changed:
drivers/staging/asus_oled/asus_oled.c
drivers/staging/comedi/drivers/dt9812.c
drivers/staging/comedi/drivers/usbdux.c
drivers/staging/comedi/drivers/usbduxfast.c
drivers/staging/comedi/drivers/vmk80xx.c
drivers/staging/frontier/alphatrack.c
drivers/staging/frontier/tranzport.c
drivers/staging/go7007/go7007-usb.c
drivers/staging/go7007/s2250-loader.c
drivers/staging/line6/driver.c
drivers/staging/otus/zdusb.c
drivers/staging/quatech_usb2/quatech_usb2.c
drivers/staging/rtl8192su/r8192U_core.c
drivers/staging/rtl8192u/r8192U_core.c
drivers/staging/serqt_usb2/serqt_usb2.c
drivers/staging/winbond/wbusb.c

index c597fb27bd533e5c965934fc0deb85692444ea69..cadb6f7321add9a7b217f515f45ec8a5375711f5 100644 (file)
@@ -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?)*/
index 312f4f282bd7671c35f6465fd035c2d2090a7c2f..96caae36279c6a642441b47a0a3aa7bf3310d877 100644 (file)
@@ -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 */
 };
index 9a1b559c4b0d2b29ed06f52322951266f881c330..0c854a6f1ca614b348cceaa895852a1595b30a8b 100644 (file)
@@ -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 */
index 2e675cce7dbf5157fc4613c5f84fc4e4143c2e59..4ff48860fc570388215f624bf0beb6f3fc95323b 100644 (file)
@@ -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 */
index c34a0b9141e2a51f012edbc6ed2b10154401dad4..6479c38d027876c98aeff47f561538fa73fd7fb2 100644 (file)
@@ -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},
index 15aed87fe1bb5a0310d17684f5dcd6a47a4501f0..a50a21518a8ea77d06f9e142369bb929ec22a40f 100644 (file)
@@ -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 */
 };
index ef8fcc8c67bd7db85cbc14607967a70e26487147..2f03f43f3a2e4c543ffc0a0511f1a94d49281a28 100644 (file)
@@ -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 */
 };
index 1e89dc04ec23a21227e4bc79704291baea07eb31..baace8367cb02365d8cb56fdc752fdecb0049f92 100644 (file)
@@ -444,7 +444,7 @@ static struct go7007_usb_board board_sensoray_2250 = {
        },
 };
 
-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,
index c152ab9be2fb1a6c6e1863410f15371a4a36107a..ef833e0d63ae83939d3f6b0e070dcda54aae77ba 100644 (file)
@@ -148,7 +148,7 @@ static void s2250loader_disconnect(struct usb_interface *interface)
        unlock_kernel();
 }
 
-static struct usb_device_id s2250loader_ids[] = {
+static const struct usb_device_id s2250loader_ids[] = {
        {USB_DEVICE(0x1943, 0xa250)},
        {}                          /* Terminating entry */
 };
index e4078a92d399c13bae12a65a0809dc5f411b556d..0392a4bc8cc8cf96ce253d61c7072fcbe8ee8496 100644 (file)
@@ -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) },
index 2a6d937ba5e875fc0d3f1878122d68c992063d96..4cd9b7f5a8871fcba539183869cf8e47120c5652 100644 (file)
@@ -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) },
index f7726f1d3641895e238d4364e0c6f15cc46aa2d3..1561f74a413bd045694d4e74fb8ef82dc8988bf0 100644 (file)
@@ -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)},
index f15be1eca324b50db4996f97f82a5d5771a3e774..23d1d35be7ed7a97faed964b4b8eb81f54a2b68b 100644 (file)
@@ -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)},
index 7cf7ea703bba0bf0cf7fc8b9c066a94bd354410b..f1e085ba1cf1639c7b9f7761feaf04bf320dc470 100644 (file)
@@ -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)},
index 060e9de3b065d1300cbe8dded0dd3a009e003af2..375a50580a28bc34cf2910b0b7de0740ad5bc047 100644 (file)
@@ -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)},
index 1c58763594912e0f02391a921d88965f63b34a4a..ecf418dcefd95e04f7266a1573fda2332267d992 100644 (file)
@@ -23,7 +23,7 @@ MODULE_DESCRIPTION("IS89C35 802.11bg WLAN USB Driver");
 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) },