diff options
author | Mauro Carvalho Chehab <mchehab@kernel.org> | 2022-03-28 23:41:35 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2022-04-18 08:36:44 +0300 |
commit | 5710a24b34576a8873ee836953575fdb234b37e2 (patch) | |
tree | 5bdca69e2f0a604343e452231ea590c2b06f0739 /drivers/media/usb | |
parent | 9c06331ca07f0e7288c949e7969ab108aa1c9807 (diff) | |
download | linux-5710a24b34576a8873ee836953575fdb234b37e2.tar.xz |
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.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r-- | drivers/media/usb/dvb-usb/vp7045.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/media/usb/dvb-usb/vp7045.c b/drivers/media/usb/dvb-usb/vp7045.c index 23e3a90af1f4..1dc2b18d44d8 100644 --- a/drivers/media/usb/dvb-usb/vp7045.c +++ b/drivers/media/usb/dvb-usb/vp7045.c @@ -172,13 +172,21 @@ static int vp7045_usb_probe(struct usb_interface *intf, THIS_MODULE, NULL, adapter_nr); } -static struct usb_device_id vp7045_usb_table [] = { - { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7045_COLD) }, - { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7045_WARM) }, - { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_DNTV_TINYUSB2_COLD) }, - { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_DNTV_TINYUSB2_WARM) }, - { 0 }, +enum { + VISIONPLUS_VP7045_COLD, + VISIONPLUS_VP7045_WARM, + VISIONPLUS_TINYUSB2_COLD, + VISIONPLUS_TINYUSB2_WARM, }; + +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); static struct dvb_usb_device_properties vp7045_properties = { @@ -221,12 +229,12 @@ static struct dvb_usb_device_properties vp7045_properties = { .num_device_descs = 2, .devices = { { .name = "Twinhan USB2.0 DVB-T receiver (TwinhanDTV Alpha/MagicBox II)", - .cold_ids = { &vp7045_usb_table[0], NULL }, - .warm_ids = { &vp7045_usb_table[1], NULL }, + .cold_ids = { &vp7045_usb_table[VISIONPLUS_VP7045_COLD], NULL }, + .warm_ids = { &vp7045_usb_table[VISIONPLUS_VP7045_WARM], NULL }, }, { .name = "DigitalNow TinyUSB 2 DVB-t Receiver", - .cold_ids = { &vp7045_usb_table[2], NULL }, - .warm_ids = { &vp7045_usb_table[3], NULL }, + .cold_ids = { &vp7045_usb_table[VISIONPLUS_TINYUSB2_COLD], NULL }, + .warm_ids = { &vp7045_usb_table[VISIONPLUS_TINYUSB2_WARM], NULL }, }, { NULL }, } |