diff options
author | Jiri Kosina <jkosina@suse.cz> | 2017-11-15 11:10:38 +0100 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2017-11-15 11:10:38 +0100 |
commit | 6ed7a70be54ef6148cbfce0d59d12d2aa41bbb23 (patch) | |
tree | 718281e0f03caaf45c3928fab322e60f7631a9bb /drivers/hid/hid-cp2112.c | |
parent | b50b9d3d21e0af1b8bda94d43c569593d45587af (diff) | |
parent | 7da85fbf1c87d4f73621e0e7666a3387497075a9 (diff) |
Merge branch 'for-4.15/upstream' into for-linus
- cp2112: GPIO error handling and Kconfig fixes from Sébastien Szymanski
- i2c-hid: fixup / quirk for Apollo-Lake based laptops, from Hans de Goede
- Input/Core: add eraser tool support, from Ping Cheng
- small assorted code fixes
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-cp2112.c')
-rw-r--r-- | drivers/hid/hid-cp2112.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c index 078026f63b6f..68cdc962265b 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c @@ -21,7 +21,7 @@ * Data Sheet: * http://www.silabs.com/Support%20Documents/TechnicalDocs/CP2112.pdf * Programming Interface Specification: - * http://www.silabs.com/Support%20Documents/TechnicalDocs/AN495.pdf + * https://www.silabs.com/documents/public/application-notes/an495-cp2112-interface-specification.pdf */ #include <linux/gpio.h> @@ -196,6 +196,8 @@ static int cp2112_gpio_direction_input(struct gpio_chip *chip, unsigned offset) HID_REQ_GET_REPORT); if (ret != CP2112_GPIO_CONFIG_LENGTH) { hid_err(hdev, "error requesting GPIO config: %d\n", ret); + if (ret >= 0) + ret = -EIO; goto exit; } @@ -205,8 +207,10 @@ static int cp2112_gpio_direction_input(struct gpio_chip *chip, unsigned offset) ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT, HID_REQ_SET_REPORT); - if (ret < 0) { + if (ret != CP2112_GPIO_CONFIG_LENGTH) { hid_err(hdev, "error setting GPIO config: %d\n", ret); + if (ret >= 0) + ret = -EIO; goto exit; } @@ -214,7 +218,7 @@ static int cp2112_gpio_direction_input(struct gpio_chip *chip, unsigned offset) exit: mutex_unlock(&dev->lock); - return ret < 0 ? ret : -EIO; + return ret; } static void cp2112_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |