[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201120133318.3428231-22-mkl@pengutronix.de>
Date: Fri, 20 Nov 2020 14:33:14 +0100
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, kuba@...nel.org, linux-can@...r.kernel.org,
kernel@...gutronix.de, Jimmy Assarsson <extja@...ser.com>,
Marc Kleine-Budde <mkl@...gutronix.de>
Subject: [net-next 21/25] can: kvaser_usb: Add USB_{LEAF,HYDRA}_PRODUCT_ID_END defines
From: Jimmy Assarsson <extja@...ser.com>
Add USB_{LEAF,HYDRA}_PRODUCT_ID_END defines, representing the last USB PID
entry in respectively family. This removes the need to update the
kvaser_is_{leaf,hydra}() functions whenever new devices are added.
Signed-off-by: Jimmy Assarsson <extja@...ser.com>
Link: https://lore.kernel.org/r/20201115163027.16851-3-jimmyassarsson@gmail.com
Signed-off-by: Marc Kleine-Budde <mkl@...gutronix.de>
---
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
index d6e18bcb1a7f..1dffcd19c456 100644
--- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
+++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
@@ -58,6 +58,8 @@
#define USB_LEAF_LIGHT_HS_V2_OEM_PRODUCT_ID 290
#define USB_USBCAN_LIGHT_2HS_PRODUCT_ID 291
#define USB_MINI_PCIE_2HS_PRODUCT_ID 292
+#define USB_LEAF_PRODUCT_ID_END \
+ USB_MINI_PCIE_2HS_PRODUCT_ID
/* Kvaser USBCan-II devices product ids */
#define USB_USBCAN_REVB_PRODUCT_ID 2
@@ -78,13 +80,15 @@
#define USB_ATI_USBCAN_PRO_2HS_V2_PRODUCT_ID 268
#define USB_ATI_MEMO_PRO_2HS_V2_PRODUCT_ID 269
#define USB_HYBRID_PRO_CANLIN_PRODUCT_ID 270
+#define USB_HYDRA_PRODUCT_ID_END \
+ USB_HYBRID_PRO_CANLIN_PRODUCT_ID
static inline bool kvaser_is_leaf(const struct usb_device_id *id)
{
return (id->idProduct >= USB_LEAF_DEVEL_PRODUCT_ID &&
id->idProduct <= USB_CAN_R_PRODUCT_ID) ||
(id->idProduct >= USB_LEAF_LITE_V2_PRODUCT_ID &&
- id->idProduct <= USB_MINI_PCIE_2HS_PRODUCT_ID);
+ id->idProduct <= USB_LEAF_PRODUCT_ID_END);
}
static inline bool kvaser_is_usbcan(const struct usb_device_id *id)
@@ -96,7 +100,7 @@ static inline bool kvaser_is_usbcan(const struct usb_device_id *id)
static inline bool kvaser_is_hydra(const struct usb_device_id *id)
{
return id->idProduct >= USB_BLACKBIRD_V2_PRODUCT_ID &&
- id->idProduct <= USB_HYBRID_PRO_CANLIN_PRODUCT_ID;
+ id->idProduct <= USB_HYDRA_PRODUCT_ID_END;
}
static const struct usb_device_id kvaser_usb_table[] = {
--
2.29.2
Powered by blists - more mailing lists