Skip to content

Commit b47bc7c

Browse files
zlatistivWolfram Sang
authored andcommitted
i2c: Compare the return value of gpiod_get_direction against GPIO_LINE_DIRECTION_OUT
The GPIO_LINE_DIRECTION_* definitions have just recently been exposed to gpio consumers.h by breaking them out in a separate defs.h file. Use this to validate the gpio direction instead of the hard-coded literal. Signed-off-by: Nikola Z. Ivanov <zlatistiv@gmail.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
1 parent 617eb7c commit b47bc7c

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

drivers/i2c/i2c-core-base.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,7 @@ static int i2c_init_recovery(struct i2c_adapter *adap)
445445
bri->set_scl = set_scl_gpio_value;
446446
if (bri->sda_gpiod) {
447447
bri->get_sda = get_sda_gpio_value;
448-
/* FIXME: add proper flag instead of '0' once available */
449-
if (gpiod_get_direction(bri->sda_gpiod) == 0)
448+
if (gpiod_get_direction(bri->sda_gpiod) == GPIO_LINE_DIRECTION_OUT)
450449
bri->set_sda = set_sda_gpio_value;
451450
}
452451
} else if (bri->recover_bus == i2c_generic_scl_recovery) {

0 commit comments

Comments
 (0)