Skip to content

Commit

Permalink
HID: mcp2221: change 'select GPIOLIB' to imply
Browse files Browse the repository at this point in the history
To avoid recursive dependencies on GPIOLIB when 'imply IIO' is requested
with other drivers we should switch GPIOLIB to an imply.

This isn't the most ideal solution but avoids modifiying the Kconfig for
other drivers, and only requires a singular IS_REACHABLE(CONFIG_GPIOLIB)
check.

Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Matt Ranostay authored and Jiri Kosina committed Oct 18, 2022
1 parent deb3b88 commit ea418b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/hid/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@ config HID_ALPS
config HID_MCP2221
tristate "Microchip MCP2221 HID USB-to-I2C/SMbus host support"
depends on USB_HID && I2C
depends on GPIOLIB
imply GPIOLIB
help
Provides I2C and SMBUS host adapter functionality over USB-HID
through MCP2221 device.
Expand Down
2 changes: 2 additions & 0 deletions drivers/hid/hid-mcp2221.c
Original file line number Diff line number Diff line change
Expand Up @@ -915,9 +915,11 @@ static int mcp2221_probe(struct hid_device *hdev,
mcp->gc->can_sleep = 1;
mcp->gc->parent = &hdev->dev;

#if IS_REACHABLE(CONFIG_GPIOLIB)
ret = devm_gpiochip_add_data(&hdev->dev, mcp->gc, mcp);
if (ret)
return ret;
#endif

return 0;
}
Expand Down

0 comments on commit ea418b3

Please sign in to comment.