Skip to content

Commit

Permalink
HID: i2c-hid: Do not fail probing if gpiolib is not enabled
Browse files Browse the repository at this point in the history
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 <gabriele.mzt@gmail.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Mika Westerberg authored and Jiri Kosina committed Apr 23, 2015
1 parent 8de29a3 commit a7d2bf2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/hid/i2c-hid/i2c-hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,7 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client,
union acpi_object *obj;
struct acpi_device *adev;
acpi_handle handle;
int ret;

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

return acpi_dev_add_driver_gpios(adev, i2c_hid_acpi_gpios);
/* GPIOs are optional */
ret = acpi_dev_add_driver_gpios(adev, i2c_hid_acpi_gpios);
return ret < 0 && ret != -ENXIO ? ret : 0;
}

static const struct acpi_device_id i2c_hid_acpi_match[] = {
Expand Down

0 comments on commit a7d2bf2

Please sign in to comment.