Skip to content

Commit 3d74c9e

Browse files
mranostayJiri Kosina
authored andcommitted
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: 960f9df ("HID: mcp2221: add ADC/DAC support via iio subsystem") Signed-off-by: Matt Ranostay <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent e91fc48 commit 3d74c9e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/hid/hid-mcp2221.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,7 @@ static const struct i2c_algorithm mcp_i2c_algo = {
585585
.functionality = mcp_i2c_func,
586586
};
587587

588+
#if IS_REACHABLE(CONFIG_GPIOLIB)
588589
static int mcp_gpio_get(struct gpio_chip *gc,
589590
unsigned int offset)
590591
{
@@ -688,6 +689,7 @@ static int mcp_gpio_get_direction(struct gpio_chip *gc,
688689

689690
return GPIO_LINE_DIRECTION_OUT;
690691
}
692+
#endif
691693

692694
/* Gives current state of i2c engine inside mcp2221 */
693695
static int mcp_get_i2c_eng_state(struct mcp2221 *mcp,
@@ -1153,6 +1155,7 @@ static int mcp2221_probe(struct hid_device *hdev,
11531155
}
11541156
i2c_set_adapdata(&mcp->adapter, mcp);
11551157

1158+
#if IS_REACHABLE(CONFIG_GPIOLIB)
11561159
/* Setup GPIO chip */
11571160
mcp->gc = devm_kzalloc(&hdev->dev, sizeof(*mcp->gc), GFP_KERNEL);
11581161
if (!mcp->gc)
@@ -1169,7 +1172,6 @@ static int mcp2221_probe(struct hid_device *hdev,
11691172
mcp->gc->can_sleep = 1;
11701173
mcp->gc->parent = &hdev->dev;
11711174

1172-
#if IS_REACHABLE(CONFIG_GPIOLIB)
11731175
ret = devm_gpiochip_add_data(&hdev->dev, mcp->gc, mcp);
11741176
if (ret)
11751177
return ret;

0 commit comments

Comments
 (0)