Skip to content

Commit a7d2bf2

Browse files
westeriJiri Kosina
authored andcommitted
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 a485923 ("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 <[email protected]> Signed-off-by: Mika Westerberg <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 8de29a3 commit a7d2bf2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/hid/i2c-hid/i2c-hid.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,7 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client,
862862
union acpi_object *obj;
863863
struct acpi_device *adev;
864864
acpi_handle handle;
865+
int ret;
865866

866867
handle = ACPI_HANDLE(&client->dev);
867868
if (!handle || acpi_bus_get_device(handle, &adev))
@@ -877,7 +878,9 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client,
877878
pdata->hid_descriptor_address = obj->integer.value;
878879
ACPI_FREE(obj);
879880

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;
881884
}
882885

883886
static const struct acpi_device_id i2c_hid_acpi_match[] = {

0 commit comments

Comments
 (0)