media: dvb-usb: pctv452e: use an enum for the device number
authorMauro Carvalho Chehab <mchehab@kernel.org>
Mon, 28 Mar 2022 20:41:30 +0000 (22:41 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Mon, 18 Apr 2022 05:36:44 +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/283a8c6bdf9778f832b4f6acc104c06688281668.1648499509.git.mchehab@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/usb/dvb-usb/pctv452e.c
include/media/dvb-usb-ids.h

index 9b78b40abc6d1b2ea42584b125016e2d95a51f3b..f0794c68c622e2b261025330eda17e81ca54a84b 100644 (file)
@@ -951,13 +951,19 @@ static int pctv452e_tuner_attach(struct dvb_usb_adapter *a)
        return 0;
 }
 
+enum {
+       PINNACLE_PCTV_452E,
+       TECHNOTREND_CONNECT_S2_3600,
+       TECHNOTREND_CONNECT_S2_3650_CI,
+};
+
 static struct usb_device_id pctv452e_usb_table[] = {
-       {USB_DEVICE(USB_VID_PINNACLE, USB_PID_PCTV_452E)},
-       {USB_DEVICE(USB_VID_TECHNOTREND, USB_PID_TECHNOTREND_CONNECT_S2_3600)},
-       {USB_DEVICE(USB_VID_TECHNOTREND,
-                               USB_PID_TECHNOTREND_CONNECT_S2_3650_CI)},
-       {}
+       DVB_USB_DEV(PINNACLE, PINNACLE_PCTV_452E),
+       DVB_USB_DEV(TECHNOTREND, TECHNOTREND_CONNECT_S2_3600),
+       DVB_USB_DEV(TECHNOTREND, TECHNOTREND_CONNECT_S2_3650_CI),
+       { }
 };
+
 MODULE_DEVICE_TABLE(usb, pctv452e_usb_table);
 
 static struct dvb_usb_device_properties pctv452e_properties = {
@@ -1006,7 +1012,7 @@ static struct dvb_usb_device_properties pctv452e_properties = {
        .devices = {
                { .name = "PCTV HDTV USB",
                  .cold_ids = { NULL, NULL }, /* this is a warm only device */
-                 .warm_ids = { &pctv452e_usb_table[0], NULL }
+                 .warm_ids = { &pctv452e_usb_table[PINNACLE_PCTV_452E], NULL }
                },
                { NULL },
        }
@@ -1060,11 +1066,11 @@ static struct dvb_usb_device_properties tt_connect_s2_3600_properties = {
        .devices = {
                { .name = "Technotrend TT Connect S2-3600",
                  .cold_ids = { NULL, NULL }, /* this is a warm only device */
-                 .warm_ids = { &pctv452e_usb_table[1], NULL }
+                 .warm_ids = { &pctv452e_usb_table[TECHNOTREND_CONNECT_S2_3600], NULL }
                },
                { .name = "Technotrend TT Connect S2-3650-CI",
                  .cold_ids = { NULL, NULL },
-                 .warm_ids = { &pctv452e_usb_table[2], NULL }
+                 .warm_ids = { &pctv452e_usb_table[TECHNOTREND_CONNECT_S2_3650_CI], NULL }
                },
                { NULL },
        }
index 6aa15988b5771f72e261548bf8fc166cffc74e1f..ed6e37f23cbc20ca8155ff765f0fdd6045284178 100644 (file)
 #define USB_PID_PCTV_200E                              0x020e
 #define USB_PID_PCTV_400E                              0x020f
 #define USB_PID_PCTV_450E                              0x0222
-#define USB_PID_PCTV_452E                              0x021f
 #define USB_PID_PCTV_78E                               0x025a
 #define USB_PID_PCTV_79E                               0x0262
 #define USB_PID_PINNACLE_EXPRESSCARD_320CX             0x022e
 #define USB_PID_PINNACLE_PCTV74E                       0x0246
 #define USB_PID_PINNACLE_PCTV801E                      0x023a
 #define USB_PID_PINNACLE_PCTV801E_SE                   0x023b
+#define USB_PID_PINNACLE_PCTV_452E                     0x021f
 #define USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T     0x0229
 #define USB_PID_PINNACLE_PCTV_DVB_T_FLASH              0x0228
 #define USB_PID_PIXELVIEW_SBTVD                        0x5010