diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2022-10-20 18:30:00 +0300 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2022-10-21 14:44:05 +0300 |
commit | 3d74c9eca1a2bda03e45f18d13154ac3e0dfba85 (patch) | |
tree | 3a32bd88231ed80539285d2550c9e459f2f947dc /drivers/hid/hid-mcp2221.c | |
parent | e91fc483552df10291f9efac5dd9241ca129f2a4 (diff) | |
download | linux-3d74c9eca1a2bda03e45f18d13154ac3e0dfba85.tar.xz |
HID: mcp2221: correct undefined references when CONFIG_GPIOLIB isn't defined
Singular #ifdef IS_REACHABLE(CONFIG_GPIOLIB) weren't covering all the
gpiolib functions that were being referenced.
Update the code regions that are commented out when CONFIG_GPIOLIB isn't
enabled to avoid errors.
Fixes: 960f9df7c620 ("HID: mcp2221: add ADC/DAC support via iio subsystem")
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-mcp2221.c')
-rw-r--r-- | drivers/hid/hid-mcp2221.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/hid/hid-mcp2221.c b/drivers/hid/hid-mcp2221.c index 3014932c8cef..5886543b17f3 100644 --- a/drivers/hid/hid-mcp2221.c +++ b/drivers/hid/hid-mcp2221.c @@ -585,6 +585,7 @@ static const struct i2c_algorithm mcp_i2c_algo = { .functionality = mcp_i2c_func, }; +#if IS_REACHABLE(CONFIG_GPIOLIB) static int mcp_gpio_get(struct gpio_chip *gc, unsigned int offset) { @@ -688,6 +689,7 @@ static int mcp_gpio_get_direction(struct gpio_chip *gc, return GPIO_LINE_DIRECTION_OUT; } +#endif /* Gives current state of i2c engine inside mcp2221 */ static int mcp_get_i2c_eng_state(struct mcp2221 *mcp, @@ -1153,6 +1155,7 @@ static int mcp2221_probe(struct hid_device *hdev, } i2c_set_adapdata(&mcp->adapter, mcp); +#if IS_REACHABLE(CONFIG_GPIOLIB) /* Setup GPIO chip */ mcp->gc = devm_kzalloc(&hdev->dev, sizeof(*mcp->gc), GFP_KERNEL); if (!mcp->gc) @@ -1169,7 +1172,6 @@ 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; |