Commit e7378e09 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Benjamin Tissoires

HID: cp2112: Define maximum GPIO constant and use it

Define maximum GPIO constant and use it in the driver.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230703185222.50554-8-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarBenjamin Tissoires <bentiss@kernel.org>
parent ff3b9e49
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#define CP2112_GPIO_CONFIG_LENGTH 5 #define CP2112_GPIO_CONFIG_LENGTH 5
#define CP2112_GPIO_GET_LENGTH 2 #define CP2112_GPIO_GET_LENGTH 2
#define CP2112_GPIO_SET_LENGTH 3 #define CP2112_GPIO_SET_LENGTH 3
#define CP2112_GPIO_MAX_GPIO 8
enum { enum {
CP2112_GPIO_CONFIG = 0x02, CP2112_GPIO_CONFIG = 0x02,
...@@ -1108,7 +1109,7 @@ static void cp2112_gpio_poll_callback(struct work_struct *work) ...@@ -1108,7 +1109,7 @@ static void cp2112_gpio_poll_callback(struct work_struct *work)
goto exit; goto exit;
gpio_mask = ret; gpio_mask = ret;
for_each_set_bit(virq, &dev->irq_mask, 8) { for_each_set_bit(virq, &dev->irq_mask, CP2112_GPIO_MAX_GPIO) {
irq = irq_find_mapping(dev->gc.irq.domain, virq); irq = irq_find_mapping(dev->gc.irq.domain, virq);
if (!irq) if (!irq)
continue; continue;
...@@ -1295,7 +1296,7 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -1295,7 +1296,7 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
dev->gc.set = cp2112_gpio_set; dev->gc.set = cp2112_gpio_set;
dev->gc.get = cp2112_gpio_get; dev->gc.get = cp2112_gpio_get;
dev->gc.base = -1; dev->gc.base = -1;
dev->gc.ngpio = 8; dev->gc.ngpio = CP2112_GPIO_MAX_GPIO;
dev->gc.can_sleep = 1; dev->gc.can_sleep = 1;
dev->gc.parent = &hdev->dev; dev->gc.parent = &hdev->dev;
......
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