Skip to content

Commit ee0682b

Browse files
andy-shevBenjamin Tissoires
authored andcommitted
HID: cp2112: Define all GPIO mask and use it
Define all GPIO mask 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 e7378e0 commit ee0682b

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
@@ -32,6 +32,7 @@
3232
#define CP2112_GPIO_GET_LENGTH 2
3333
#define CP2112_GPIO_SET_LENGTH 3
3434
#define CP2112_GPIO_MAX_GPIO 8
35+
#define CP2112_GPIO_ALL_GPIO_MASK GENMASK(7, 0)
3536

3637
enum {
3738
CP2112_GPIO_CONFIG = 0x02,
@@ -173,7 +174,7 @@ struct cp2112_device {
173174
u8 gpio_prev_state;
174175
};
175176

176-
static int gpio_push_pull = 0xFF;
177+
static int gpio_push_pull = CP2112_GPIO_ALL_GPIO_MASK;
177178
module_param(gpio_push_pull, int, S_IRUGO | S_IWUSR);
178179
MODULE_PARM_DESC(gpio_push_pull, "GPIO push-pull configuration bitmask");
179180

@@ -226,7 +227,7 @@ static void cp2112_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
226227
mutex_lock(&dev->lock);
227228

228229
buf[0] = CP2112_GPIO_SET;
229-
buf[1] = value ? 0xff : 0;
230+
buf[1] = value ? CP2112_GPIO_ALL_GPIO_MASK : 0;
230231
buf[2] = 1 << offset;
231232

232233
ret = hid_hw_raw_request(hdev, CP2112_GPIO_SET, buf,

0 commit comments

Comments
 (0)