media: usb: constify usb_device_id
authorArvind Yadav <arvind.yadav.cs@gmail.com>
Sun, 13 Aug 2017 08:54:43 +0000 (04:54 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Sun, 20 Aug 2017 12:04:51 +0000 (08:04 -0400)
usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

'drivers/media/usb/b2c2/flexcop-usb.c' Fix checkpatch.pl error:
ERROR: space prohibited before open square bracket '['.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
17 files changed:
drivers/media/usb/airspy/airspy.c
drivers/media/usb/as102/as102_usb_drv.c
drivers/media/usb/b2c2/flexcop-usb.c
drivers/media/usb/cpia2/cpia2_usb.c
drivers/media/usb/dvb-usb-v2/az6007.c
drivers/media/usb/hackrf/hackrf.c
drivers/media/usb/hdpvr/hdpvr-core.c
drivers/media/usb/msi2500/msi2500.c
drivers/media/usb/s2255/s2255drv.c
drivers/media/usb/stk1160/stk1160-core.c
drivers/media/usb/stkwebcam/stk-webcam.c
drivers/media/usb/tm6000/tm6000-cards.c
drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c
drivers/media/usb/ttusb-dec/ttusb_dec.c
drivers/media/usb/usbtv/usbtv-core.c
drivers/media/usb/uvc/uvc_driver.c
drivers/media/usb/zr364xx/zr364xx.c

index 8251942bcd121ee339ddd4ba55645c918773a410..07f3f4e7144acfe4180f25a2e2c35074db2c2df6 100644 (file)
@@ -1087,7 +1087,7 @@ err_free_mem:
 }
 
 /* USB device ID list */
-static struct usb_device_id airspy_id_table[] = {
+static const struct usb_device_id airspy_id_table[] = {
        { USB_DEVICE(0x1d50, 0x60a1) }, /* AirSpy */
        { }
 };
index 68c3a80ce349b73ae566541b41a63e1fb6a6fbeb..ea57859aee777d7712795a3a3674f1cc2ebb3707 100644 (file)
@@ -33,7 +33,7 @@ static void as102_usb_stop_stream(struct as102_dev_t *dev);
 static int as102_open(struct inode *inode, struct file *file);
 static int as102_release(struct inode *inode, struct file *file);
 
-static struct usb_device_id as102_usb_id_table[] = {
+static const struct usb_device_id as102_usb_id_table[] = {
        { USB_DEVICE(AS102_USB_DEVICE_VENDOR_ID, AS102_USB_DEVICE_PID_0001) },
        { USB_DEVICE(PCTV_74E_USB_VID, PCTV_74E_USB_PID) },
        { USB_DEVICE(ELGATO_EYETV_DTT_USB_VID, ELGATO_EYETV_DTT_USB_PID) },
index 788c73803138d9e3d319dc27c8d43db5b421e083..a8f3169e30b31b278a45665805c565627134cdeb 100644 (file)
@@ -596,7 +596,7 @@ static void flexcop_usb_disconnect(struct usb_interface *intf)
        info("%s successfully deinitialized and disconnected.", DRIVER_NAME);
 }
 
-static struct usb_device_id flexcop_usb_table [] = {
+static const struct usb_device_id flexcop_usb_table[] = {
        { USB_DEVICE(0x0af7, 0x0101) },
        { }
 };
index 1c7e16e5d88b53f0258fd2bcd749e10299945ec0..6089036049d91bab352645bfb49c748c5ed79894 100644 (file)
@@ -60,7 +60,7 @@ static int submit_urbs(struct camera_data *cam);
 static int set_alternate(struct camera_data *cam, unsigned int alt);
 static int configure_transfer_mode(struct camera_data *cam, unsigned int alt);
 
-static struct usb_device_id cpia2_id_table[] = {
+static const struct usb_device_id cpia2_id_table[] = {
        {USB_DEVICE(0x0553, 0x0100)},
        {USB_DEVICE(0x0553, 0x0140)},
        {USB_DEVICE(0x0553, 0x0151)},  /* STV0676 */
index 50c07fe7dacb7e32fad123235906fe8e65595746..72f26300c2366c110d23ce72cc127382a7c7a675 100644 (file)
@@ -933,7 +933,7 @@ static struct dvb_usb_device_properties az6007_cablestar_hdci_props = {
        }
 };
 
-static struct usb_device_id az6007_usb_table[] = {
+static const struct usb_device_id az6007_usb_table[] = {
        {DVB_USB_DEVICE(USB_VID_AZUREWAVE, USB_PID_AZUREWAVE_6007,
                &az6007_props, "Azurewave 6007", RC_MAP_EMPTY)},
        {DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_H7,
index d9a5252605114b100653b1495c45e73917a27072..a41b305c55d4454aa178619493ba36cb0324ed0f 100644 (file)
@@ -1545,7 +1545,7 @@ err:
 }
 
 /* USB device ID list */
-static struct usb_device_id hackrf_id_table[] = {
+static const struct usb_device_id hackrf_id_table[] = {
        { USB_DEVICE(0x1d50, 0x6089) }, /* HackRF One */
        { }
 };
index 15f016ad5b89156913b981e11df2dfdbc01948c3..dbe29c6c4d8b37e841839cebeb795924c14fa79c 100644 (file)
@@ -53,7 +53,7 @@ MODULE_PARM_DESC(boost_audio, "boost the audio signal");
 
 
 /* table of devices that work with this driver */
-static struct usb_device_id hdpvr_table[] = {
+static const struct usb_device_id hdpvr_table[] = {
        { USB_DEVICE(HD_PVR_VENDOR_ID, HD_PVR_PRODUCT_ID) },
        { USB_DEVICE(HD_PVR_VENDOR_ID, HD_PVR_PRODUCT_ID1) },
        { USB_DEVICE(HD_PVR_VENDOR_ID, HD_PVR_PRODUCT_ID2) },
index bb3d31e2a0b55b180084eea39054cdc9fbc5125e..79bfd2dbe649805dc126d5962f1c9a5683555348 100644 (file)
@@ -1308,7 +1308,7 @@ err:
 }
 
 /* USB device ID list */
-static struct usb_device_id msi2500_id_table[] = {
+static const struct usb_device_id msi2500_id_table[] = {
        {USB_DEVICE(0x1df7, 0x2500)}, /* Mirics MSi3101 SDR Dongle */
        {USB_DEVICE(0x2040, 0xd300)}, /* Hauppauge WinTV 133559 LF */
        {}
index 6a88b1dbb3a0d7c18acec303f6e6e51db75b8691..23f606e7cd73f822c7168ce0756949b618470a23 100644 (file)
@@ -381,7 +381,7 @@ MODULE_PARM_DESC(jpeg_enable, "Jpeg enable(1-on 0-off) default 1");
 
 /* USB device table */
 #define USB_SENSORAY_VID       0x1943
-static struct usb_device_id s2255_table[] = {
+static const struct usb_device_id s2255_table[] = {
        {USB_DEVICE(USB_SENSORAY_VID, 0x2255)},
        {USB_DEVICE(USB_SENSORAY_VID, 0x2257)}, /*same family as 2255*/
        { }                     /* Terminating entry */
index c86eb61647138b394a3c22c7e62b354f1f1df378..bea8bbbb84fba2978cfa98567ef421f5a3fed945 100644 (file)
@@ -47,7 +47,7 @@ MODULE_AUTHOR("Ezequiel Garcia");
 MODULE_DESCRIPTION("STK1160 driver");
 
 /* Devices supported by this driver */
-static struct usb_device_id stk1160_id_table[] = {
+static const struct usb_device_id stk1160_id_table[] = {
        { USB_DEVICE(0x05e1, 0x0408) },
        { }
 };
index 93330be8cc54b5e6195b09264c00515980e4c30f..39abb58c65dd99a71e362f6d688323e9ade9bd46 100644 (file)
@@ -55,7 +55,7 @@ MODULE_AUTHOR("Jaime Velasco Juan <jsagarribay@gmail.com> and Nicolas VIVIEN");
 MODULE_DESCRIPTION("Syntek DC1125 webcam driver");
 
 /* Some cameras have audio interfaces, we aren't interested in those */
-static struct usb_device_id stkwebcam_table[] = {
+static const struct usb_device_id stkwebcam_table[] = {
        { USB_DEVICE_AND_INTERFACE_INFO(0x174f, 0xa311, 0xff, 0xff, 0xff) },
        { USB_DEVICE_AND_INTERFACE_INFO(0x05e1, 0x0501, 0xff, 0xff, 0xff) },
        { }
index b293dea6554f568f3f46dd1318987f87c06f18cd..2537643a18089cb19d2da56ba74c0a5a5d2caf02 100644 (file)
@@ -613,7 +613,7 @@ static struct tm6000_board tm6000_boards[] = {
 };
 
 /* table of devices that work with this driver */
-static struct usb_device_id tm6000_id_table[] = {
+static const struct usb_device_id tm6000_id_table[] = {
        { USB_DEVICE(0x6000, 0x0001), .driver_info = TM5600_BOARD_GENERIC },
        { USB_DEVICE(0x6000, 0x0002), .driver_info = TM6010_BOARD_GENERIC },
        { USB_DEVICE(0x06e1, 0xf332), .driver_info = TM6000_BOARD_ADSTECH_DUAL_TV },
index 22a488d3749d3d2cbc7407663faa77ad80c2256f..b842f367249f3361bd46ae73dd1aacfc7b500100 100644 (file)
@@ -1795,7 +1795,7 @@ static void ttusb_disconnect(struct usb_interface *intf)
        dprintk("%s: TTUSB DVB disconnected\n", __func__);
 }
 
-static struct usb_device_id ttusb_table[] = {
+static const struct usb_device_id ttusb_table[] = {
        {USB_DEVICE(0xb48, 0x1003)},
        {USB_DEVICE(0xb48, 0x1004)},
        {USB_DEVICE(0xb48, 0x1005)},
index 01c7e6d4481c54567d77bd966f56d2ea87506b66..cdefb5dfbbdcda39fbe1bbc840c5042836d3bc15 100644 (file)
@@ -1791,7 +1791,7 @@ static void ttusb_dec_set_model(struct ttusb_dec *dec,
        }
 }
 
-static struct usb_device_id ttusb_dec_table[] = {
+static const struct usb_device_id ttusb_dec_table[] = {
        {USB_DEVICE(0x0b48, 0x1006)},   /* DEC3000-s */
        /*{USB_DEVICE(0x0b48, 0x1007)},    Unconfirmed */
        {USB_DEVICE(0x0b48, 0x1008)},   /* DEC2000-t */
index ceb953be07704f29162e079046ac68461876b136..f06f09a0876e5cbf383c2dbe9b61b60fab072092 100644 (file)
@@ -142,7 +142,7 @@ static void usbtv_disconnect(struct usb_interface *intf)
        v4l2_device_put(&usbtv->v4l2_dev);
 }
 
-static struct usb_device_id usbtv_id_table[] = {
+static const struct usb_device_id usbtv_id_table[] = {
        { USB_DEVICE(0x1b71, 0x3002) },
        {}
 };
index 4f463bf2b877c30b9921767ad9577aa252a09288..c6feda8e55d3ddbea6152c384337e990944bae6f 100644 (file)
@@ -2283,7 +2283,7 @@ MODULE_PARM_DESC(timeout, "Streaming control requests timeout");
  * VENDOR_SPEC because they don't announce themselves as UVC devices, even
  * though they are compliant.
  */
-static struct usb_device_id uvc_ids[] = {
+static const struct usb_device_id uvc_ids[] = {
        /* LogiLink Wireless Webcam */
        { .match_flags          = USB_DEVICE_ID_MATCH_DEVICE
                                | USB_DEVICE_ID_MATCH_INT_INFO,
index efdcd5bd6a4cd82d55b0bf1458cfa74af8547bcf..25fa81c631c6c06d4b117258f1d39b55babe7225 100644 (file)
@@ -93,7 +93,7 @@ MODULE_PARM_DESC(mode, "0 = 320x240, 1 = 160x120, 2 = 640x480");
 
 /* Devices supported by this driver
  * .driver_info contains the init method used by the camera */
-static struct usb_device_id device_table[] = {
+static const struct usb_device_id device_table[] = {
        {USB_DEVICE(0x08ca, 0x0109), .driver_info = METHOD0 },
        {USB_DEVICE(0x041e, 0x4024), .driver_info = METHOD0 },
        {USB_DEVICE(0x0d64, 0x0108), .driver_info = METHOD0 },