aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2015-04-14 10:35:12 -0400
committerJiri Kosina <jkosina@suse.cz>2015-04-23 04:58:16 -0400
commita7d2bf25a4837e6514a2747380fd4539b63ee20c (patch)
tree2f98331463789ca975c0b4bc812344a6214bde56 /drivers/hid
parent8de29a35dc840a05e451ad035bcb06e21ccf605f (diff)
HID: i2c-hid: Do not fail probing if gpiolib is not enabled
Using GPIOs and gpiolib is optional. If the kernel is compiled without GPIO support the driver should not fail if it finds the interrupt using normal methods. However, commit a485923efbb8 ("HID: i2c-hid: Add support for ACPI GPIO interrupts") did not take into account that acpi_dev_add_driver_gpios() returns -ENXIO when !CONFIG_GPIOLIB. Fix this by checking the return value against -ENXIO and 0 and only in that case fail the probe. Reported-by: Gabriele Mazzotta <gabriele.mzt@gmail.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/i2c-hid/i2c-hid.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index ab4dd952b6ba..92d6cdf02460 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -862,6 +862,7 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client,
862 union acpi_object *obj; 862 union acpi_object *obj;
863 struct acpi_device *adev; 863 struct acpi_device *adev;
864 acpi_handle handle; 864 acpi_handle handle;
865 int ret;
865 866
866 handle = ACPI_HANDLE(&client->dev); 867 handle = ACPI_HANDLE(&client->dev);
867 if (!handle || acpi_bus_get_device(handle, &adev)) 868 if (!handle || acpi_bus_get_device(handle, &adev))
@@ -877,7 +878,9 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client,
877 pdata->hid_descriptor_address = obj->integer.value; 878 pdata->hid_descriptor_address = obj->integer.value;
878 ACPI_FREE(obj); 879 ACPI_FREE(obj);
879 880
880 return acpi_dev_add_driver_gpios(adev, i2c_hid_acpi_gpios); 881 /* GPIOs are optional */
882 ret = acpi_dev_add_driver_gpios(adev, i2c_hid_acpi_gpios);
883 return ret < 0 && ret != -ENXIO ? ret : 0;
881} 884}
882 885
883static const struct acpi_device_id i2c_hid_acpi_match[] = { 886static const struct acpi_device_id i2c_hid_acpi_match[] = {