Skip to content

Commit e7378e0

Browse files
andy-shevBenjamin Tissoires
authored andcommitted
HID: cp2112: Define maximum GPIO constant and use it
Define maximum GPIO constant and use it in the driver. Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
1 parent ff3b9e4 commit e7378e0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/hid/hid-cp2112.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#define CP2112_GPIO_CONFIG_LENGTH 5
3232
#define CP2112_GPIO_GET_LENGTH 2
3333
#define CP2112_GPIO_SET_LENGTH 3
34+
#define CP2112_GPIO_MAX_GPIO 8
3435

3536
enum {
3637
CP2112_GPIO_CONFIG = 0x02,
@@ -1108,7 +1109,7 @@ static void cp2112_gpio_poll_callback(struct work_struct *work)
11081109
goto exit;
11091110

11101111
gpio_mask = ret;
1111-
for_each_set_bit(virq, &dev->irq_mask, 8) {
1112+
for_each_set_bit(virq, &dev->irq_mask, CP2112_GPIO_MAX_GPIO) {
11121113
irq = irq_find_mapping(dev->gc.irq.domain, virq);
11131114
if (!irq)
11141115
continue;
@@ -1295,7 +1296,7 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
12951296
dev->gc.set = cp2112_gpio_set;
12961297
dev->gc.get = cp2112_gpio_get;
12971298
dev->gc.base = -1;
1298-
dev->gc.ngpio = 8;
1299+
dev->gc.ngpio = CP2112_GPIO_MAX_GPIO;
12991300
dev->gc.can_sleep = 1;
13001301
dev->gc.parent = &hdev->dev;
13011302

0 commit comments

Comments
 (0)