aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/usb
diff options
context:
space:
mode:
authorMauro Carvalho Chehab2022-03-28 22:41:37 +0200
committerMauro Carvalho Chehab2022-04-18 07:36:44 +0200
commit281b21c56ed325ad5a23bf2dce45a8d7f751a577 (patch)
tree997ebfaac0d1dd1032462d3a5245a17f7a43b9e5 /drivers/media/usb
parentd763479abd67fc67a13aabe0ce19b4d775fbdcee (diff)
media: dvb-usb: dibusb-mc: use an enum for the device number
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/f1d4fa4960b709152ae693800c830e19a4bc1f48.1648499509.git.mchehab@kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r--drivers/media/usb/dvb-usb/dibusb-mc.c88
1 files changed, 54 insertions, 34 deletions
diff --git a/drivers/media/usb/dvb-usb/dibusb-mc.c b/drivers/media/usb/dvb-usb/dibusb-mc.c
index e2689977c8c8..00cb016f6266 100644
--- a/drivers/media/usb/dvb-usb/dibusb-mc.c
+++ b/drivers/media/usb/dvb-usb/dibusb-mc.c
@@ -24,25 +24,45 @@ static int dibusb_mc_probe(struct usb_interface *intf,
}
/* do not change the order of the ID table */
-static struct usb_device_id dibusb_dib3000mc_table [] = {
-/* 00 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_COLD) },
-/* 01 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_WARM) },
-/* 02 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_USB2_COLD) },
-/* 03 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_USB2_WARM) }, // ( ? )
-/* 04 */ { USB_DEVICE(USB_VID_LITEON, USB_PID_LITEON_DVB_T_COLD) },
-/* 05 */ { USB_DEVICE(USB_VID_LITEON, USB_PID_LITEON_DVB_T_WARM) },
-/* 06 */ { USB_DEVICE(USB_VID_EMPIA, USB_PID_DIGIVOX_MINI_SL_COLD) },
-/* 07 */ { USB_DEVICE(USB_VID_EMPIA, USB_PID_DIGIVOX_MINI_SL_WARM) },
-/* 08 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB2_COLD) },
-/* 09 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB2_WARM) },
-/* 10 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14_COLD) },
-/* 11 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14_WARM) },
-/* 12 */ { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_COLD) },
-/* 13 */ { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_WARM) },
-/* 14 */ { USB_DEVICE(USB_VID_HUMAX_COEX, USB_PID_DVB_T_USB_STICK_HIGH_SPEED_COLD) },
-/* 15 */ { USB_DEVICE(USB_VID_HUMAX_COEX, USB_PID_DVB_T_USB_STICK_HIGH_SPEED_WARM) },
- { } /* Terminating entry */
+enum {
+ DIBCOM_MOD3001_COLD,
+ DIBCOM_MOD3001_WARM,
+ ULTIMA_TVBOX_USB2_COLD,
+ ULTIMA_TVBOX_USB2_WARM,
+ LITEON_DVB_T_COLD,
+ LITEON_DVB_T_WARM,
+ EMPIA_DIGIVOX_MINI_SL_COLD,
+ EMPIA_DIGIVOX_MINI_SL_WARM,
+ GRANDTEC_DVBT_USB2_COLD,
+ GRANDTEC_DVBT_USB2_WARM,
+ ULTIMA_ARTEC_T14_COLD,
+ ULTIMA_ARTEC_T14_WARM,
+ LEADTEK_WINFAST_DTV_DONGLE_COLD,
+ LEADTEK_WINFAST_DTV_DONGLE_WARM,
+ HUMAX_DVB_T_STICK_HIGH_SPEED_COLD,
+ HUMAX_DVB_T_STICK_HIGH_SPEED_WARM,
};
+
+static struct usb_device_id dibusb_dib3000mc_table[] = {
+ DVB_USB_DEV(DIBCOM, DIBCOM_MOD3001_COLD),
+ DVB_USB_DEV(DIBCOM, DIBCOM_MOD3001_WARM),
+ DVB_USB_DEV(ULTIMA_ELECTRONIC, ULTIMA_TVBOX_USB2_COLD),
+ DVB_USB_DEV(ULTIMA_ELECTRONIC, ULTIMA_TVBOX_USB2_WARM),
+ DVB_USB_DEV(LITEON, LITEON_DVB_T_COLD),
+ DVB_USB_DEV(LITEON, LITEON_DVB_T_WARM),
+ DVB_USB_DEV(EMPIA, EMPIA_DIGIVOX_MINI_SL_COLD),
+ DVB_USB_DEV(EMPIA, EMPIA_DIGIVOX_MINI_SL_WARM),
+ DVB_USB_DEV(GRANDTEC, GRANDTEC_DVBT_USB2_COLD),
+ DVB_USB_DEV(GRANDTEC, GRANDTEC_DVBT_USB2_WARM),
+ DVB_USB_DEV(ULTIMA_ELECTRONIC, ULTIMA_ARTEC_T14_COLD),
+ DVB_USB_DEV(ULTIMA_ELECTRONIC, ULTIMA_ARTEC_T14_WARM),
+ DVB_USB_DEV(LEADTEK, LEADTEK_WINFAST_DTV_DONGLE_COLD),
+ DVB_USB_DEV(LEADTEK, LEADTEK_WINFAST_DTV_DONGLE_WARM),
+ DVB_USB_DEV(HUMAX_COEX, HUMAX_DVB_T_STICK_HIGH_SPEED_COLD),
+ DVB_USB_DEV(HUMAX_COEX, HUMAX_DVB_T_STICK_HIGH_SPEED_WARM),
+ { }
+};
+
MODULE_DEVICE_TABLE (usb, dibusb_dib3000mc_table);
static struct dvb_usb_device_properties dibusb_mc_properties = {
@@ -95,37 +115,37 @@ static struct dvb_usb_device_properties dibusb_mc_properties = {
.num_device_descs = 8,
.devices = {
{ "DiBcom USB2.0 DVB-T reference design (MOD3000P)",
- { &dibusb_dib3000mc_table[0], NULL },
- { &dibusb_dib3000mc_table[1], NULL },
+ { &dibusb_dib3000mc_table[DIBCOM_MOD3001_COLD], NULL },
+ { &dibusb_dib3000mc_table[DIBCOM_MOD3001_WARM], NULL },
},
{ "Artec T1 USB2.0 TVBOX (please check the warm ID)",
- { &dibusb_dib3000mc_table[2], NULL },
- { &dibusb_dib3000mc_table[3], NULL },
+ { &dibusb_dib3000mc_table[ULTIMA_TVBOX_USB2_COLD], NULL },
+ { &dibusb_dib3000mc_table[ULTIMA_TVBOX_USB2_WARM], NULL },
},
{ "LITE-ON USB2.0 DVB-T Tuner",
/* Also rebranded as Intuix S800, Toshiba */
- { &dibusb_dib3000mc_table[4], NULL },
- { &dibusb_dib3000mc_table[5], NULL },
+ { &dibusb_dib3000mc_table[LITEON_DVB_T_COLD], NULL },
+ { &dibusb_dib3000mc_table[LITEON_DVB_T_WARM], NULL },
},
{ "MSI Digivox Mini SL",
- { &dibusb_dib3000mc_table[6], NULL },
- { &dibusb_dib3000mc_table[7], NULL },
+ { &dibusb_dib3000mc_table[EMPIA_DIGIVOX_MINI_SL_COLD], NULL },
+ { &dibusb_dib3000mc_table[EMPIA_DIGIVOX_MINI_SL_WARM], NULL },
},
{ "GRAND - USB2.0 DVB-T adapter",
- { &dibusb_dib3000mc_table[8], NULL },
- { &dibusb_dib3000mc_table[9], NULL },
+ { &dibusb_dib3000mc_table[GRANDTEC_DVBT_USB2_COLD], NULL },
+ { &dibusb_dib3000mc_table[GRANDTEC_DVBT_USB2_WARM], NULL },
},
{ "Artec T14 - USB2.0 DVB-T",
- { &dibusb_dib3000mc_table[10], NULL },
- { &dibusb_dib3000mc_table[11], NULL },
+ { &dibusb_dib3000mc_table[ULTIMA_ARTEC_T14_COLD], NULL },
+ { &dibusb_dib3000mc_table[ULTIMA_ARTEC_T14_WARM], NULL },
},
{ "Leadtek - USB2.0 Winfast DTV dongle",
- { &dibusb_dib3000mc_table[12], NULL },
- { &dibusb_dib3000mc_table[13], NULL },
+ { &dibusb_dib3000mc_table[LEADTEK_WINFAST_DTV_DONGLE_COLD], NULL },
+ { &dibusb_dib3000mc_table[LEADTEK_WINFAST_DTV_DONGLE_WARM], NULL },
},
{ "Humax/Coex DVB-T USB Stick 2.0 High Speed",
- { &dibusb_dib3000mc_table[14], NULL },
- { &dibusb_dib3000mc_table[15], NULL },
+ { &dibusb_dib3000mc_table[HUMAX_DVB_T_STICK_HIGH_SPEED_COLD], NULL },
+ { &dibusb_dib3000mc_table[HUMAX_DVB_T_STICK_HIGH_SPEED_WARM], NULL },
},
{ NULL },
}