Commit 5710a24b authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

media: dvb-usb: vp7045: 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/0241bf842bf592dfa01b0ef4916afda396194f98.1648499509.git.mchehab@kernel.orgSigned-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 9c06331c
...@@ -172,13 +172,21 @@ static int vp7045_usb_probe(struct usb_interface *intf, ...@@ -172,13 +172,21 @@ static int vp7045_usb_probe(struct usb_interface *intf,
THIS_MODULE, NULL, adapter_nr); THIS_MODULE, NULL, adapter_nr);
} }
static struct usb_device_id vp7045_usb_table [] = { enum {
{ USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7045_COLD) }, VISIONPLUS_VP7045_COLD,
{ USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7045_WARM) }, VISIONPLUS_VP7045_WARM,
{ USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_DNTV_TINYUSB2_COLD) }, VISIONPLUS_TINYUSB2_COLD,
{ USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_DNTV_TINYUSB2_WARM) }, VISIONPLUS_TINYUSB2_WARM,
{ 0 },
}; };
static struct usb_device_id vp7045_usb_table[] = {
DVB_USB_DEV(VISIONPLUS, VISIONPLUS_VP7045_COLD),
DVB_USB_DEV(VISIONPLUS, VISIONPLUS_VP7045_WARM),
DVB_USB_DEV(VISIONPLUS, VISIONPLUS_TINYUSB2_COLD),
DVB_USB_DEV(VISIONPLUS, VISIONPLUS_TINYUSB2_WARM),
{ }
};
MODULE_DEVICE_TABLE(usb, vp7045_usb_table); MODULE_DEVICE_TABLE(usb, vp7045_usb_table);
static struct dvb_usb_device_properties vp7045_properties = { static struct dvb_usb_device_properties vp7045_properties = {
...@@ -221,12 +229,12 @@ static struct dvb_usb_device_properties vp7045_properties = { ...@@ -221,12 +229,12 @@ static struct dvb_usb_device_properties vp7045_properties = {
.num_device_descs = 2, .num_device_descs = 2,
.devices = { .devices = {
{ .name = "Twinhan USB2.0 DVB-T receiver (TwinhanDTV Alpha/MagicBox II)", { .name = "Twinhan USB2.0 DVB-T receiver (TwinhanDTV Alpha/MagicBox II)",
.cold_ids = { &vp7045_usb_table[0], NULL }, .cold_ids = { &vp7045_usb_table[VISIONPLUS_VP7045_COLD], NULL },
.warm_ids = { &vp7045_usb_table[1], NULL }, .warm_ids = { &vp7045_usb_table[VISIONPLUS_VP7045_WARM], NULL },
}, },
{ .name = "DigitalNow TinyUSB 2 DVB-t Receiver", { .name = "DigitalNow TinyUSB 2 DVB-t Receiver",
.cold_ids = { &vp7045_usb_table[2], NULL }, .cold_ids = { &vp7045_usb_table[VISIONPLUS_TINYUSB2_COLD], NULL },
.warm_ids = { &vp7045_usb_table[3], NULL }, .warm_ids = { &vp7045_usb_table[VISIONPLUS_TINYUSB2_WARM], NULL },
}, },
{ NULL }, { NULL },
} }
......
...@@ -199,8 +199,6 @@ ...@@ -199,8 +199,6 @@
#define USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM 0xdb55 #define USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM 0xdb55
#define USB_PID_DIGIVOX_MINI_SL_COLD 0xe360 #define USB_PID_DIGIVOX_MINI_SL_COLD 0xe360
#define USB_PID_DIGIVOX_MINI_SL_WARM 0xe361 #define USB_PID_DIGIVOX_MINI_SL_WARM 0xe361
#define USB_PID_DNTV_TINYUSB2_COLD 0x3223
#define USB_PID_DNTV_TINYUSB2_WARM 0x3224
#define USB_PID_DPOSH_M9206_COLD 0x9206 #define USB_PID_DPOSH_M9206_COLD 0x9206
#define USB_PID_DPOSH_M9206_WARM 0xa090 #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_COLD 0x5000
...@@ -413,8 +411,6 @@ ...@@ -413,8 +411,6 @@
#define USB_PID_TWINHAN_VP7021_WARM 0x3208 #define USB_PID_TWINHAN_VP7021_WARM 0x3208
#define USB_PID_TWINHAN_VP7041_COLD 0x3201 #define USB_PID_TWINHAN_VP7041_COLD 0x3201
#define USB_PID_TWINHAN_VP7041_WARM 0x3202 #define USB_PID_TWINHAN_VP7041_WARM 0x3202
#define USB_PID_TWINHAN_VP7045_COLD 0x3205
#define USB_PID_TWINHAN_VP7045_WARM 0x3206
#define USB_PID_ULTIMA_TVBOX_AN2235_COLD 0x8107 #define USB_PID_ULTIMA_TVBOX_AN2235_COLD 0x8107
#define USB_PID_ULTIMA_TVBOX_AN2235_WARM 0x8108 #define USB_PID_ULTIMA_TVBOX_AN2235_WARM 0x8108
#define USB_PID_ULTIMA_TVBOX_ANCHOR_COLD 0x2235 #define USB_PID_ULTIMA_TVBOX_ANCHOR_COLD 0x2235
...@@ -428,9 +424,13 @@ ...@@ -428,9 +424,13 @@
#define USB_PID_UNK_HYPER_PALTEK_COLD 0x005e #define USB_PID_UNK_HYPER_PALTEK_COLD 0x005e
#define USB_PID_UNK_HYPER_PALTEK_WARM 0x005f #define USB_PID_UNK_HYPER_PALTEK_WARM 0x005f
#define USB_PID_VISIONPLUS_PINNACLE_PCTV310E 0x3211 #define USB_PID_VISIONPLUS_PINNACLE_PCTV310E 0x3211
#define USB_PID_VISIONPLUS_TINYUSB2_COLD 0x3223
#define USB_PID_VISIONPLUS_TINYUSB2_WARM 0x3224
#define USB_PID_VISIONPLUS_VP7020_COLD 0x3203 #define USB_PID_VISIONPLUS_VP7020_COLD 0x3203
#define USB_PID_VISIONPLUS_VP7020_WARM 0x3204 #define USB_PID_VISIONPLUS_VP7020_WARM 0x3204
#define USB_PID_VISIONPLUS_VP7021_COLD 0x3207 #define USB_PID_VISIONPLUS_VP7021_COLD 0x3207
#define USB_PID_VISIONPLUS_VP7045_COLD 0x3205
#define USB_PID_VISIONPLUS_VP7045_WARM 0x3206
#define USB_PID_WIDEVIEW_DTT200U_COLD 0x0201 #define USB_PID_WIDEVIEW_DTT200U_COLD 0x0201
#define USB_PID_WIDEVIEW_DTT200U_WARM 0x0301 #define USB_PID_WIDEVIEW_DTT200U_WARM 0x0301
#define USB_PID_WIDEVIEW_WT220U_COLD 0x0222 #define USB_PID_WIDEVIEW_WT220U_COLD 0x0222
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment