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>
This commit is contained in:
Mauro Carvalho Chehab 2022-03-28 22:41:37 +02:00
parent d763479abd
commit 281b21c56e
2 changed files with 62 additions and 42 deletions

View File

@ -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 },
}

View File

@ -111,8 +111,6 @@
#define USB_PID_ANUBIS_MSI_DIGI_VOX_MINI_II 0x1513
#define USB_PID_ANYSEE 0x861f
#define USB_PID_ARTEC_T14BR 0x810f
#define USB_PID_ARTEC_T14_COLD 0x810b
#define USB_PID_ARTEC_T14_WARM 0x810c
#define USB_PID_ASUS_U3000 0x171f
#define USB_PID_ASUS_U3000H 0x1736
#define USB_PID_ASUS_U3100 0x173f
@ -195,12 +193,8 @@
#define USB_PID_DIBCOM_TFE8096P 0x1f9C
#define USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD 0xdb54
#define USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM 0xdb55
#define USB_PID_DIGIVOX_MINI_SL_COLD 0xe360
#define USB_PID_DIGIVOX_MINI_SL_WARM 0xe361
#define USB_PID_DPOSH_M9206_COLD 0x9206
#define USB_PID_DPOSH_M9206_WARM 0xa090
#define USB_PID_DVB_T_USB_STICK_HIGH_SPEED_COLD 0x5000
#define USB_PID_DVB_T_USB_STICK_HIGH_SPEED_WARM 0x5001
#define USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD 0xdb50
#define USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM 0xdb51
#define USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD 0xdb58
@ -228,6 +222,8 @@
#define USB_PID_ELGATO_EYETV_SAT 0x002a
#define USB_PID_ELGATO_EYETV_SAT_V2 0x0025
#define USB_PID_ELGATO_EYETV_SAT_V3 0x0036
#define USB_PID_EMPIA_DIGIVOX_MINI_SL_COLD 0xe360
#define USB_PID_EMPIA_DIGIVOX_MINI_SL_WARM 0xe361
#define USB_PID_EMPIA_VSTREAM_COLD 0x17de
#define USB_PID_EMPIA_VSTREAM_WARM 0x17df
#define USB_PID_EVOLVEO_XTRATV_STICK 0xa115
@ -270,6 +266,8 @@
#define USB_PID_HAUPPAUGE_TIGER_ATSC_B210 0xb210
#define USB_PID_HAUPPAUGE_WINTV_NOVA_T_USB2_COLD 0x9300
#define USB_PID_HAUPPAUGE_WINTV_NOVA_T_USB2_WARM 0x9301
#define USB_PID_HUMAX_DVB_T_STICK_HIGH_SPEED_COLD 0x5000
#define USB_PID_HUMAX_DVB_T_STICK_HIGH_SPEED_WARM 0x5001
#define USB_PID_INTEL_CE9500 0x9500
#define USB_PID_ITETECH_IT9135 0x9135
#define USB_PID_ITETECH_IT9135_9005 0x9005
@ -289,6 +287,8 @@
#define USB_PID_KWORLD_VSTREAM_COLD 0x17de
#define USB_PID_KYE_DVB_T_COLD 0x701e
#define USB_PID_KYE_DVB_T_WARM 0x701f
#define USB_PID_LEADTEK_WINFAST_DTV_DONGLE_COLD 0x6025
#define USB_PID_LEADTEK_WINFAST_DTV_DONGLE_WARM 0x6026
#define USB_PID_LITEON_DVB_T_COLD 0xf000
#define USB_PID_LITEON_DVB_T_WARM 0xf001
#define USB_PID_MEDION_MD95700 0x0932
@ -412,6 +412,8 @@
#define USB_PID_TWINHAN_VP7021_WARM 0x3208
#define USB_PID_TWINHAN_VP7041_COLD 0x3201
#define USB_PID_TWINHAN_VP7041_WARM 0x3202
#define USB_PID_ULTIMA_ARTEC_T14_COLD 0x810b
#define USB_PID_ULTIMA_ARTEC_T14_WARM 0x810c
#define USB_PID_ULTIMA_TVBOX_AN2235_COLD 0x8107
#define USB_PID_ULTIMA_TVBOX_AN2235_WARM 0x8108
#define USB_PID_ULTIMA_TVBOX_ANCHOR_COLD 0x2235
@ -447,13 +449,11 @@
#define USB_PID_WIDEVIEW_WT220U_ZL0353_WARM 0x022b
#define USB_PID_WINFAST_DTV2000DS 0x6a04
#define USB_PID_WINFAST_DTV2000DS_PLUS 0x6f12
#define USB_PID_WINFAST_DTV_DONGLE_COLD 0x6025
#define USB_PID_WINFAST_DTV_DONGLE_GOLD 0x6029
#define USB_PID_WINFAST_DTV_DONGLE_H 0x60f6
#define USB_PID_WINFAST_DTV_DONGLE_MINID 0x6f0f
#define USB_PID_WINFAST_DTV_DONGLE_STK7700P 0x6f00
#define USB_PID_WINFAST_DTV_DONGLE_STK7700P_2 0x6f01
#define USB_PID_WINFAST_DTV_DONGLE_WARM 0x6026
#define USB_PID_WINTV_SOLOHD 0x0264
#define USB_PID_WINTV_SOLOHD_2 0x8268
#define USB_PID_XBOX_ONE_TUNER 0x02d5