summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikola Z. Ivanov <zlatistiv@gmail.com>2026-04-15 23:50:21 +0300
committerWolfram Sang <wsa+renesas@sang-engineering.com>2026-05-04 13:19:25 +0300
commitb47bc7c022ddab7c79a84dd5f3f0d07fe09ec786 (patch)
tree5a708678367b7956cb3a52190bbb757465e0f5f7
parent617eb7c0961a8dfcfc811844a6396e406b2923ea (diff)
downloadlinux-b47bc7c022ddab7c79a84dd5f3f0d07fe09ec786.tar.xz
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>
-rw-r--r--drivers/i2c/i2c-core-base.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index 9c46147e3506..a2132d70fb36 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -445,8 +445,7 @@ static int i2c_init_recovery(struct i2c_adapter *adap)
bri->set_scl = set_scl_gpio_value;
if (bri->sda_gpiod) {
bri->get_sda = get_sda_gpio_value;
- /* FIXME: add proper flag instead of '0' once available */
- if (gpiod_get_direction(bri->sda_gpiod) == 0)
+ if (gpiod_get_direction(bri->sda_gpiod) == GPIO_LINE_DIRECTION_OUT)
bri->set_sda = set_sda_gpio_value;
}
} else if (bri->recover_bus == i2c_generic_scl_recovery) {