media: dvb-usb: a800: use an enum for the device number
authorMauro Carvalho Chehab <mchehab@kernel.org>
Mon, 28 Mar 2022 20:41:17 +0000 (22:41 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Mon, 18 Apr 2022 05:36:43 +0000 (07:36 +0200)
The device number is currently a value that needs to be the same
on two separate tables, but the code doesn't actually enforce it,
leading to errors as boards get added or removed.

Fix it by using an enum.

Link: https://lore.kernel.org/linux-media/dc8f9ec6cc8f2e16967a61752a292c46622c01dc.1648499509.git.mchehab@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/usb/dvb-usb/a800.c

index 36b5b62274125991be04a9142613840cd6bd5bfe..5f294784923c4620a3cad5ea25cf60467af2a764 100644 (file)
@@ -72,11 +72,17 @@ static int a800_probe(struct usb_interface *intf,
 }
 
 /* do not change the order of the ID table */
-static struct usb_device_id a800_table [] = {
-/* 00 */       { USB_DEVICE(USB_VID_AVERMEDIA,     USB_PID_AVERMEDIA_DVBT_USB2_COLD) },
-/* 01 */       { USB_DEVICE(USB_VID_AVERMEDIA,     USB_PID_AVERMEDIA_DVBT_USB2_WARM) },
-                       { }             /* Terminating entry */
+enum {
+       AVERMEDIA_DVBT_USB2_COLD,
+       AVERMEDIA_DVBT_USB2_WARM,
 };
+
+static struct usb_device_id a800_table[] = {
+       DVB_USB_DEV(AVERMEDIA, AVERMEDIA_DVBT_USB2_COLD),
+       DVB_USB_DEV(AVERMEDIA, AVERMEDIA_DVBT_USB2_WARM),
+       { }
+};
+
 MODULE_DEVICE_TABLE (usb, a800_table);
 
 static struct dvb_usb_device_properties a800_properties = {
@@ -132,8 +138,8 @@ static struct dvb_usb_device_properties a800_properties = {
        .num_device_descs = 1,
        .devices = {
                {   "AVerMedia AverTV DVB-T USB 2.0 (A800)",
-                       { &a800_table[0], NULL },
-                       { &a800_table[1], NULL },
+                       { &a800_table[AVERMEDIA_DVBT_USB2_COLD], NULL },
+                       { &a800_table[AVERMEDIA_DVBT_USB2_WARM], NULL },
                },
        }
 };