[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <5fd3c469faa115856f48037019e607edcb41d458.1648499509.git.mchehab@kernel.org>
Date: Mon, 28 Mar 2022 22:41:33 +0200
From: Mauro Carvalho Chehab <mchehab@...nel.org>
To: unlisted-recipients:; (no To-header on input)
Cc: Mauro Carvalho Chehab <mchehab@...nel.org>,
linux-kernel@...r.kernel.org, linux-media@...r.kernel.org
Subject: [PATCH 21/26] media: dvb-usb: umt-010: 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.
Signed-off-by: Mauro Carvalho Chehab <mchehab@...nel.org>
---
To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 00/26] at: https://lore.kernel.org/all/cover.1648499509.git.mchehab@kernel.org/
drivers/media/usb/dvb-usb/umt-010.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/media/usb/dvb-usb/umt-010.c b/drivers/media/usb/dvb-usb/umt-010.c
index 2181993771ae..464699b0b75b 100644
--- a/drivers/media/usb/dvb-usb/umt-010.c
+++ b/drivers/media/usb/dvb-usb/umt-010.c
@@ -81,11 +81,17 @@ static int umt_probe(struct usb_interface *intf,
}
/* do not change the order of the ID table */
-static struct usb_device_id umt_table [] = {
-/* 00 */ { USB_DEVICE(USB_VID_HANFTEK, USB_PID_HANFTEK_UMT_010_COLD) },
-/* 01 */ { USB_DEVICE(USB_VID_HANFTEK, USB_PID_HANFTEK_UMT_010_WARM) },
- { } /* Terminating entry */
+enum {
+ HANFTEK_UMT_010_COLD,
+ HANFTEK_UMT_010_WARM,
};
+
+static struct usb_device_id umt_table[] = {
+ DVB_USB_DEV(HANFTEK, HANFTEK_UMT_010_COLD),
+ DVB_USB_DEV(HANFTEK, HANFTEK_UMT_010_WARM),
+ { }
+};
+
MODULE_DEVICE_TABLE (usb, umt_table);
static struct dvb_usb_device_properties umt_properties = {
@@ -127,8 +133,8 @@ static struct dvb_usb_device_properties umt_properties = {
.num_device_descs = 1,
.devices = {
{ "Hanftek UMT-010 DVB-T USB2.0",
- { &umt_table[0], NULL },
- { &umt_table[1], NULL },
+ { &umt_table[HANFTEK_UMT_010_COLD], NULL },
+ { &umt_table[HANFTEK_UMT_010_WARM], NULL },
},
}
};
--
2.35.1
Powered by blists - more mailing lists