2017-08-13 08:55:05

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 0/3] constify media usb_device_id

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.

Arvind Yadav (3):
[PATCH 1/3] [media] usb: constify usb_device_id
[PATCH 2/3] [media] rc: constify usb_device_id
[PATCH 3/3] [media] radio: constify usb_device_id

drivers/media/radio/dsbr100.c | 2 +-
drivers/media/radio/radio-keene.c | 2 +-
drivers/media/radio/radio-ma901.c | 2 +-
drivers/media/radio/radio-mr800.c | 2 +-
drivers/media/radio/radio-raremono.c | 2 +-
drivers/media/radio/radio-shark.c | 2 +-
drivers/media/radio/radio-shark2.c | 2 +-
drivers/media/radio/si470x/radio-si470x-usb.c | 2 +-
drivers/media/radio/si4713/radio-usb-si4713.c | 2 +-
drivers/media/rc/ati_remote.c | 2 +-
drivers/media/rc/igorplugusb.c | 2 +-
drivers/media/rc/imon.c | 2 +-
drivers/media/rc/mceusb.c | 2 +-
drivers/media/rc/redrat3.c | 2 +-
drivers/media/rc/streamzap.c | 2 +-
drivers/media/usb/airspy/airspy.c | 2 +-
drivers/media/usb/as102/as102_usb_drv.c | 2 +-
drivers/media/usb/b2c2/flexcop-usb.c | 2 +-
drivers/media/usb/cpia2/cpia2_usb.c | 2 +-
drivers/media/usb/dvb-usb-v2/az6007.c | 2 +-
drivers/media/usb/hackrf/hackrf.c | 2 +-
drivers/media/usb/hdpvr/hdpvr-core.c | 2 +-
drivers/media/usb/msi2500/msi2500.c | 2 +-
drivers/media/usb/s2255/s2255drv.c | 2 +-
drivers/media/usb/stk1160/stk1160-core.c | 2 +-
drivers/media/usb/stkwebcam/stk-webcam.c | 2 +-
drivers/media/usb/tm6000/tm6000-cards.c | 2 +-
drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c | 2 +-
drivers/media/usb/ttusb-dec/ttusb_dec.c | 2 +-
drivers/media/usb/usbtv/usbtv-core.c | 2 +-
drivers/media/usb/uvc/uvc_driver.c | 2 +-
drivers/media/usb/zr364xx/zr364xx.c | 2 +-
32 files changed, 32 insertions(+), 32 deletions(-)

--
2.7.4


2017-08-13 08:55:12

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 1/3] [media] usb: constify usb_device_id

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 <[email protected]>
---
drivers/media/usb/airspy/airspy.c | 2 +-
drivers/media/usb/as102/as102_usb_drv.c | 2 +-
drivers/media/usb/b2c2/flexcop-usb.c | 2 +-
drivers/media/usb/cpia2/cpia2_usb.c | 2 +-
drivers/media/usb/dvb-usb-v2/az6007.c | 2 +-
drivers/media/usb/hackrf/hackrf.c | 2 +-
drivers/media/usb/hdpvr/hdpvr-core.c | 2 +-
drivers/media/usb/msi2500/msi2500.c | 2 +-
drivers/media/usb/s2255/s2255drv.c | 2 +-
drivers/media/usb/stk1160/stk1160-core.c | 2 +-
drivers/media/usb/stkwebcam/stk-webcam.c | 2 +-
drivers/media/usb/tm6000/tm6000-cards.c | 2 +-
drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c | 2 +-
drivers/media/usb/ttusb-dec/ttusb_dec.c | 2 +-
drivers/media/usb/usbtv/usbtv-core.c | 2 +-
drivers/media/usb/uvc/uvc_driver.c | 2 +-
drivers/media/usb/zr364xx/zr364xx.c | 2 +-
17 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/media/usb/airspy/airspy.c b/drivers/media/usb/airspy/airspy.c
index 8251942..07f3f4e 100644
--- a/drivers/media/usb/airspy/airspy.c
+++ b/drivers/media/usb/airspy/airspy.c
@@ -1087,7 +1087,7 @@ static int airspy_probe(struct usb_interface *intf,
}

/* 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 */
{ }
};
diff --git a/drivers/media/usb/as102/as102_usb_drv.c b/drivers/media/usb/as102/as102_usb_drv.c
index 68c3a80..ea57859 100644
--- a/drivers/media/usb/as102/as102_usb_drv.c
+++ b/drivers/media/usb/as102/as102_usb_drv.c
@@ -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) },
diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c
index 788c738..2fb5a54 100644
--- a/drivers/media/usb/b2c2/flexcop-usb.c
+++ b/drivers/media/usb/b2c2/flexcop-usb.c
@@ -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) },
{ }
};
diff --git a/drivers/media/usb/cpia2/cpia2_usb.c b/drivers/media/usb/cpia2/cpia2_usb.c
index 1c7e16e..6089036 100644
--- a/drivers/media/usb/cpia2/cpia2_usb.c
+++ b/drivers/media/usb/cpia2/cpia2_usb.c
@@ -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 */
diff --git a/drivers/media/usb/dvb-usb-v2/az6007.c b/drivers/media/usb/dvb-usb-v2/az6007.c
index 50c07fe..72f2630 100644
--- a/drivers/media/usb/dvb-usb-v2/az6007.c
+++ b/drivers/media/usb/dvb-usb-v2/az6007.c
@@ -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,
diff --git a/drivers/media/usb/hackrf/hackrf.c b/drivers/media/usb/hackrf/hackrf.c
index d9a5252..a41b305 100644
--- a/drivers/media/usb/hackrf/hackrf.c
+++ b/drivers/media/usb/hackrf/hackrf.c
@@ -1545,7 +1545,7 @@ static int hackrf_probe(struct usb_interface *intf,
}

/* 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 */
{ }
};
diff --git a/drivers/media/usb/hdpvr/hdpvr-core.c b/drivers/media/usb/hdpvr/hdpvr-core.c
index 15f016a..dbe29c6 100644
--- a/drivers/media/usb/hdpvr/hdpvr-core.c
+++ b/drivers/media/usb/hdpvr/hdpvr-core.c
@@ -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) },
diff --git a/drivers/media/usb/msi2500/msi2500.c b/drivers/media/usb/msi2500/msi2500.c
index bb3d31e..79bfd2d 100644
--- a/drivers/media/usb/msi2500/msi2500.c
+++ b/drivers/media/usb/msi2500/msi2500.c
@@ -1308,7 +1308,7 @@ static int msi2500_probe(struct usb_interface *intf,
}

/* 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 */
{}
diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
index 6a88b1d..23f606e 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -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 */
diff --git a/drivers/media/usb/stk1160/stk1160-core.c b/drivers/media/usb/stk1160/stk1160-core.c
index c86eb61..bea8bbb 100644
--- a/drivers/media/usb/stk1160/stk1160-core.c
+++ b/drivers/media/usb/stk1160/stk1160-core.c
@@ -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) },
{ }
};
diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c
index 6e7fc36..064ab3d 100644
--- a/drivers/media/usb/stkwebcam/stk-webcam.c
+++ b/drivers/media/usb/stkwebcam/stk-webcam.c
@@ -53,7 +53,7 @@ MODULE_AUTHOR("Jaime Velasco Juan <[email protected]> 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) },
{ }
diff --git a/drivers/media/usb/tm6000/tm6000-cards.c b/drivers/media/usb/tm6000/tm6000-cards.c
index b293dea..2537643 100644
--- a/drivers/media/usb/tm6000/tm6000-cards.c
+++ b/drivers/media/usb/tm6000/tm6000-cards.c
@@ -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 },
diff --git a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c
index 361e40b..3600658 100644
--- a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c
+++ b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c
@@ -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)},
diff --git a/drivers/media/usb/ttusb-dec/ttusb_dec.c b/drivers/media/usb/ttusb-dec/ttusb_dec.c
index 01c7e6d..cdefb5d 100644
--- a/drivers/media/usb/ttusb-dec/ttusb_dec.c
+++ b/drivers/media/usb/ttusb-dec/ttusb_dec.c
@@ -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 */
diff --git a/drivers/media/usb/usbtv/usbtv-core.c b/drivers/media/usb/usbtv/usbtv-core.c
index ceb953b..f06f09a 100644
--- a/drivers/media/usb/usbtv/usbtv-core.c
+++ b/drivers/media/usb/usbtv/usbtv-core.c
@@ -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) },
{}
};
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 70842c5..268a78f 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -2284,7 +2284,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,
diff --git a/drivers/media/usb/zr364xx/zr364xx.c b/drivers/media/usb/zr364xx/zr364xx.c
index efdcd5b..25fa81c 100644
--- a/drivers/media/usb/zr364xx/zr364xx.c
+++ b/drivers/media/usb/zr364xx/zr364xx.c
@@ -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 },
--
2.7.4

2017-08-13 08:55:18

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 3/3] [media] radio: constify usb_device_id

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.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/media/radio/dsbr100.c | 2 +-
drivers/media/radio/radio-keene.c | 2 +-
drivers/media/radio/radio-ma901.c | 2 +-
drivers/media/radio/radio-mr800.c | 2 +-
drivers/media/radio/radio-raremono.c | 2 +-
drivers/media/radio/radio-shark.c | 2 +-
drivers/media/radio/radio-shark2.c | 2 +-
drivers/media/radio/si470x/radio-si470x-usb.c | 2 +-
drivers/media/radio/si4713/radio-usb-si4713.c | 2 +-
9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/media/radio/dsbr100.c b/drivers/media/radio/dsbr100.c
index 53bc8c0..8521bb2 100644
--- a/drivers/media/radio/dsbr100.c
+++ b/drivers/media/radio/dsbr100.c
@@ -408,7 +408,7 @@ static int usb_dsbr100_probe(struct usb_interface *intf,
return retval;
}

-static struct usb_device_id usb_dsbr100_device_table[] = {
+static const struct usb_device_id usb_dsbr100_device_table[] = {
{ USB_DEVICE(DSB100_VENDOR, DSB100_PRODUCT) },
{ } /* Terminating entry */
};
diff --git a/drivers/media/radio/radio-keene.c b/drivers/media/radio/radio-keene.c
index 53a7c2e..f2ea8bc 100644
--- a/drivers/media/radio/radio-keene.c
+++ b/drivers/media/radio/radio-keene.c
@@ -45,7 +45,7 @@ MODULE_LICENSE("GPL");
#define FREQ_MUL 16000U

/* USB Device ID List */
-static struct usb_device_id usb_keene_device_table[] = {
+static const struct usb_device_id usb_keene_device_table[] = {
{USB_DEVICE_AND_INTERFACE_INFO(USB_KEENE_VENDOR, USB_KEENE_PRODUCT,
USB_CLASS_HID, 0, 0) },
{ } /* Terminating entry */
diff --git a/drivers/media/radio/radio-ma901.c b/drivers/media/radio/radio-ma901.c
index c2010a9..fdc4812 100644
--- a/drivers/media/radio/radio-ma901.c
+++ b/drivers/media/radio/radio-ma901.c
@@ -444,7 +444,7 @@ static int usb_ma901radio_probe(struct usb_interface *intf,
}

/* USB Device ID List */
-static struct usb_device_id usb_ma901radio_device_table[] = {
+static const struct usb_device_id usb_ma901radio_device_table[] = {
{ USB_DEVICE_AND_INTERFACE_INFO(USB_MA901_VENDOR, USB_MA901_PRODUCT,
USB_CLASS_HID, 0, 0) },
{ } /* Terminating entry */
diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c
index 95c1253..c9f5912 100644
--- a/drivers/media/radio/radio-mr800.c
+++ b/drivers/media/radio/radio-mr800.c
@@ -587,7 +587,7 @@ static int usb_amradio_probe(struct usb_interface *intf,
}

/* USB Device ID List */
-static struct usb_device_id usb_amradio_device_table[] = {
+static const struct usb_device_id usb_amradio_device_table[] = {
{ USB_DEVICE_AND_INTERFACE_INFO(USB_AMRADIO_VENDOR, USB_AMRADIO_PRODUCT,
USB_CLASS_HID, 0, 0) },
{ } /* Terminating entry */
diff --git a/drivers/media/radio/radio-raremono.c b/drivers/media/radio/radio-raremono.c
index bfb3a6d..3c0a22a 100644
--- a/drivers/media/radio/radio-raremono.c
+++ b/drivers/media/radio/radio-raremono.c
@@ -58,7 +58,7 @@ MODULE_LICENSE("GPL v2");
*/

/* USB Device ID List */
-static struct usb_device_id usb_raremono_device_table[] = {
+static const struct usb_device_id usb_raremono_device_table[] = {
{USB_DEVICE_AND_INTERFACE_INFO(0x10c4, 0x818a, USB_CLASS_HID, 0, 0) },
{ } /* Terminating entry */
};
diff --git a/drivers/media/radio/radio-shark.c b/drivers/media/radio/radio-shark.c
index 23971f5..22f3466 100644
--- a/drivers/media/radio/radio-shark.c
+++ b/drivers/media/radio/radio-shark.c
@@ -392,7 +392,7 @@ static int usb_shark_resume(struct usb_interface *intf)
#endif

/* Specify the bcdDevice value, as the radioSHARK and radioSHARK2 share ids */
-static struct usb_device_id usb_shark_device_table[] = {
+static const struct usb_device_id usb_shark_device_table[] = {
{ .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION |
USB_DEVICE_ID_MATCH_INT_CLASS,
.idVendor = 0x077d,
diff --git a/drivers/media/radio/radio-shark2.c b/drivers/media/radio/radio-shark2.c
index b50638e..4d1a4b3 100644
--- a/drivers/media/radio/radio-shark2.c
+++ b/drivers/media/radio/radio-shark2.c
@@ -358,7 +358,7 @@ static int usb_shark_resume(struct usb_interface *intf)
#endif

/* Specify the bcdDevice value, as the radioSHARK and radioSHARK2 share ids */
-static struct usb_device_id usb_shark_device_table[] = {
+static const struct usb_device_id usb_shark_device_table[] = {
{ .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION |
USB_DEVICE_ID_MATCH_INT_CLASS,
.idVendor = 0x077d,
diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c
index 571f29a..c311f99 100644
--- a/drivers/media/radio/si470x/radio-si470x-usb.c
+++ b/drivers/media/radio/si470x/radio-si470x-usb.c
@@ -38,7 +38,7 @@


/* USB Device ID List */
-static struct usb_device_id si470x_usb_driver_id_table[] = {
+static const struct usb_device_id si470x_usb_driver_id_table[] = {
/* Silicon Labs USB FM Radio Reference Design */
{ USB_DEVICE_AND_INTERFACE_INFO(0x10c4, 0x818a, USB_CLASS_HID, 0, 0) },
/* ADS/Tech FM Radio Receiver (formerly Instant FM Music) */
diff --git a/drivers/media/radio/si4713/radio-usb-si4713.c b/drivers/media/radio/si4713/radio-usb-si4713.c
index e5e5a16..febc9c1 100644
--- a/drivers/media/radio/si4713/radio-usb-si4713.c
+++ b/drivers/media/radio/si4713/radio-usb-si4713.c
@@ -49,7 +49,7 @@ MODULE_LICENSE("GPL v2");
#define USB_RESP_TIMEOUT 50000

/* USB Device ID List */
-static struct usb_device_id usb_si4713_usb_device_table[] = {
+static const struct usb_device_id usb_si4713_usb_device_table[] = {
{USB_DEVICE_AND_INTERFACE_INFO(USB_SI4713_VENDOR, USB_SI4713_PRODUCT,
USB_CLASS_HID, 0, 0) },
{ } /* Terminating entry */
--
2.7.4

2017-08-13 08:55:43

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 2/3] [media] rc: constify usb_device_id

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.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/media/rc/ati_remote.c | 2 +-
drivers/media/rc/igorplugusb.c | 2 +-
drivers/media/rc/imon.c | 2 +-
drivers/media/rc/mceusb.c | 2 +-
drivers/media/rc/redrat3.c | 2 +-
drivers/media/rc/streamzap.c | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c
index a4c6ad4..d1d0c48 100644
--- a/drivers/media/rc/ati_remote.c
+++ b/drivers/media/rc/ati_remote.c
@@ -198,7 +198,7 @@ static const struct ati_receiver_type type_firefly = {
.default_keymap = RC_MAP_SNAPSTREAM_FIREFLY
};

-static struct usb_device_id ati_remote_table[] = {
+static const struct usb_device_id ati_remote_table[] = {
{
USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA_REMOTE_PRODUCT_ID),
.driver_info = (unsigned long)&type_ati
diff --git a/drivers/media/rc/igorplugusb.c b/drivers/media/rc/igorplugusb.c
index cb6d4f1..c294ec5 100644
--- a/drivers/media/rc/igorplugusb.c
+++ b/drivers/media/rc/igorplugusb.c
@@ -244,7 +244,7 @@ static void igorplugusb_disconnect(struct usb_interface *intf)
usb_free_urb(ir->urb);
}

-static struct usb_device_id igorplugusb_table[] = {
+static const struct usb_device_id igorplugusb_table[] = {
/* Igor Plug USB (Atmel's Manufact. ID) */
{ USB_DEVICE(0x03eb, 0x0002) },
/* Fit PC2 Infrared Adapter */
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index bd76534..3f414ab 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -346,7 +346,7 @@ static const struct imon_usb_dev_descr imon_ir_raw = {
* devices use the SoundGraph vendor ID (0x15c2). This driver only supports
* the ffdc and later devices, which do onboard decoding.
*/
-static struct usb_device_id imon_usb_id_table[] = {
+static const struct usb_device_id imon_usb_id_table[] = {
/*
* Several devices with this same device ID, all use iMON_PAD.inf
* SoundGraph iMON PAD (IR & VFD)
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index eb13069..6664d91 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -249,7 +249,7 @@ static const struct mceusb_model mceusb_model[] = {
},
};

-static struct usb_device_id mceusb_dev_table[] = {
+static const struct usb_device_id mceusb_dev_table[] = {
/* Original Microsoft MCE IR Transceiver (often HP-branded) */
{ USB_DEVICE(VENDOR_MICROSOFT, 0x006d),
.driver_info = MCE_GEN1 },
diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
index 56d43be..48f27ac 100644
--- a/drivers/media/rc/redrat3.c
+++ b/drivers/media/rc/redrat3.c
@@ -186,7 +186,7 @@ struct redrat3_error {
} __packed;

/* table of devices that work with this driver */
-static struct usb_device_id redrat3_dev_table[] = {
+static const struct usb_device_id redrat3_dev_table[] = {
/* Original version of the RedRat3 */
{USB_DEVICE(USB_RR3USB_VENDOR_ID, USB_RR3USB_PRODUCT_ID)},
/* Second Version/release of the RedRat3 - RetRat3-II */
diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c
index b09c45a..1f00727 100644
--- a/drivers/media/rc/streamzap.c
+++ b/drivers/media/rc/streamzap.c
@@ -43,7 +43,7 @@
#define USB_STREAMZAP_PRODUCT_ID 0x0000

/* table of devices that work with this driver */
-static struct usb_device_id streamzap_table[] = {
+static const struct usb_device_id streamzap_table[] = {
/* Streamzap Remote Control */
{ USB_DEVICE(USB_STREAMZAP_VENDOR_ID, USB_STREAMZAP_PRODUCT_ID) },
/* Terminating entry */
--
2.7.4

2017-08-13 12:22:51

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH 1/3] [media] usb: constify usb_device_id

Hi Arvind,

Thank you for the patch.

On Sunday 13 Aug 2017 14:24:43 Arvind Yadav wrote:
> 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 <[email protected]>
> ---
> drivers/media/usb/airspy/airspy.c | 2 +-
> drivers/media/usb/as102/as102_usb_drv.c | 2 +-
> drivers/media/usb/b2c2/flexcop-usb.c | 2 +-
> drivers/media/usb/cpia2/cpia2_usb.c | 2 +-
> drivers/media/usb/dvb-usb-v2/az6007.c | 2 +-
> drivers/media/usb/hackrf/hackrf.c | 2 +-
> drivers/media/usb/hdpvr/hdpvr-core.c | 2 +-
> drivers/media/usb/msi2500/msi2500.c | 2 +-
> drivers/media/usb/s2255/s2255drv.c | 2 +-
> drivers/media/usb/stk1160/stk1160-core.c | 2 +-
> drivers/media/usb/stkwebcam/stk-webcam.c | 2 +-
> drivers/media/usb/tm6000/tm6000-cards.c | 2 +-
> drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c | 2 +-
> drivers/media/usb/ttusb-dec/ttusb_dec.c | 2 +-
> drivers/media/usb/usbtv/usbtv-core.c | 2 +-
> drivers/media/usb/uvc/uvc_driver.c | 2 +-

For the UVC driver,

Reviewed-by: Laurent Pinchart <[email protected]>

> drivers/media/usb/zr364xx/zr364xx.c | 2 +-
> 17 files changed, 17 insertions(+), 17 deletions(-)

--
Regards,

Laurent Pinchart

2017-08-15 11:45:21

by Sean Young

[permalink] [raw]
Subject: Re: [PATCH 2/3] [media] rc: constify usb_device_id

On Sun, Aug 13, 2017 at 02:24:44PM +0530, Arvind Yadav wrote:
> 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.
>
> Signed-off-by: Arvind Yadav <[email protected]>

Acked-by: Sean Young <[email protected]>

Thanks for spotting that.

Sean

> ---
> drivers/media/rc/ati_remote.c | 2 +-
> drivers/media/rc/igorplugusb.c | 2 +-
> drivers/media/rc/imon.c | 2 +-
> drivers/media/rc/mceusb.c | 2 +-
> drivers/media/rc/redrat3.c | 2 +-
> drivers/media/rc/streamzap.c | 2 +-
> 6 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c
> index a4c6ad4..d1d0c48 100644
> --- a/drivers/media/rc/ati_remote.c
> +++ b/drivers/media/rc/ati_remote.c
> @@ -198,7 +198,7 @@ static const struct ati_receiver_type type_firefly = {
> .default_keymap = RC_MAP_SNAPSTREAM_FIREFLY
> };
>
> -static struct usb_device_id ati_remote_table[] = {
> +static const struct usb_device_id ati_remote_table[] = {
> {
> USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA_REMOTE_PRODUCT_ID),
> .driver_info = (unsigned long)&type_ati
> diff --git a/drivers/media/rc/igorplugusb.c b/drivers/media/rc/igorplugusb.c
> index cb6d4f1..c294ec5 100644
> --- a/drivers/media/rc/igorplugusb.c
> +++ b/drivers/media/rc/igorplugusb.c
> @@ -244,7 +244,7 @@ static void igorplugusb_disconnect(struct usb_interface *intf)
> usb_free_urb(ir->urb);
> }
>
> -static struct usb_device_id igorplugusb_table[] = {
> +static const struct usb_device_id igorplugusb_table[] = {
> /* Igor Plug USB (Atmel's Manufact. ID) */
> { USB_DEVICE(0x03eb, 0x0002) },
> /* Fit PC2 Infrared Adapter */
> diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
> index bd76534..3f414ab 100644
> --- a/drivers/media/rc/imon.c
> +++ b/drivers/media/rc/imon.c
> @@ -346,7 +346,7 @@ static const struct imon_usb_dev_descr imon_ir_raw = {
> * devices use the SoundGraph vendor ID (0x15c2). This driver only supports
> * the ffdc and later devices, which do onboard decoding.
> */
> -static struct usb_device_id imon_usb_id_table[] = {
> +static const struct usb_device_id imon_usb_id_table[] = {
> /*
> * Several devices with this same device ID, all use iMON_PAD.inf
> * SoundGraph iMON PAD (IR & VFD)
> diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
> index eb13069..6664d91 100644
> --- a/drivers/media/rc/mceusb.c
> +++ b/drivers/media/rc/mceusb.c
> @@ -249,7 +249,7 @@ static const struct mceusb_model mceusb_model[] = {
> },
> };
>
> -static struct usb_device_id mceusb_dev_table[] = {
> +static const struct usb_device_id mceusb_dev_table[] = {
> /* Original Microsoft MCE IR Transceiver (often HP-branded) */
> { USB_DEVICE(VENDOR_MICROSOFT, 0x006d),
> .driver_info = MCE_GEN1 },
> diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
> index 56d43be..48f27ac 100644
> --- a/drivers/media/rc/redrat3.c
> +++ b/drivers/media/rc/redrat3.c
> @@ -186,7 +186,7 @@ struct redrat3_error {
> } __packed;
>
> /* table of devices that work with this driver */
> -static struct usb_device_id redrat3_dev_table[] = {
> +static const struct usb_device_id redrat3_dev_table[] = {
> /* Original version of the RedRat3 */
> {USB_DEVICE(USB_RR3USB_VENDOR_ID, USB_RR3USB_PRODUCT_ID)},
> /* Second Version/release of the RedRat3 - RetRat3-II */
> diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c
> index b09c45a..1f00727 100644
> --- a/drivers/media/rc/streamzap.c
> +++ b/drivers/media/rc/streamzap.c
> @@ -43,7 +43,7 @@
> #define USB_STREAMZAP_PRODUCT_ID 0x0000
>
> /* table of devices that work with this driver */
> -static struct usb_device_id streamzap_table[] = {
> +static const struct usb_device_id streamzap_table[] = {
> /* Streamzap Remote Control */
> { USB_DEVICE(USB_STREAMZAP_VENDOR_ID, USB_STREAMZAP_PRODUCT_ID) },
> /* Terminating entry */
> --
> 2.7.4

2017-08-21 10:03:14

by Alexey Klimov

[permalink] [raw]
Subject: Re: [PATCH 3/3] [media] radio: constify usb_device_id

Hi Arvind,

thanks for the patch!

On Sun, Aug 13, 2017 at 9:54 AM, Arvind Yadav <[email protected]> wrote:
> 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.
>
> Signed-off-by: Arvind Yadav <[email protected]>

For dsbr100, radio-mr800 and radio-ma901 please feel free to use:

Acked-by: Alexey Klimov <[email protected]>


> ---
> drivers/media/radio/dsbr100.c | 2 +-
> drivers/media/radio/radio-keene.c | 2 +-
> drivers/media/radio/radio-ma901.c | 2 +-
> drivers/media/radio/radio-mr800.c | 2 +-
> drivers/media/radio/radio-raremono.c | 2 +-
> drivers/media/radio/radio-shark.c | 2 +-
> drivers/media/radio/radio-shark2.c | 2 +-
> drivers/media/radio/si470x/radio-si470x-usb.c | 2 +-
> drivers/media/radio/si4713/radio-usb-si4713.c | 2 +-
> 9 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/media/radio/dsbr100.c b/drivers/media/radio/dsbr100.c
> index 53bc8c0..8521bb2 100644


[...]

Best regards,
Alexey