The lack of get_direction() callback in this driver causes GPIOLIB to
emit a warning. Implement it.
Fixes: e623c4303ed1 ("gpiolib: sanitize the return value of gpio_chip::get_direction()")
Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
---
drivers/gpio/gpio-max730x.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/drivers/gpio/gpio-max730x.c b/drivers/gpio/gpio-max730x.c
index 84c7c2dca822..117a9dbff9c0 100644
--- a/drivers/gpio/gpio-max730x.c
+++ b/drivers/gpio/gpio-max730x.c
@@ -160,6 +160,31 @@ static int max7301_set(struct gpio_chip *chip, unsigned int offset, int value)
return ret;
}
+static int max7301_get_direction(struct gpio_chip *chip, unsigned offset)
+{
+ struct max7301 *ts = container_of(chip, struct max7301, chip);
+ u8 *config;
+ u8 offset_bits;
+ int ret;
+
+ /* First 4 pins are unused in the controller */
+ offset += 4;
+ offset_bits = (offset & 3) << 1;
+
+ config = &ts->port_config[offset >> 2];
+
+ mutex_lock(&ts->lock);
+
+ if (*config & (PIN_CONFIG_OUT << offset_bits))
+ ret = GPIO_LINE_DIRECTION_OUT;
+ else
+ ret = GPIO_LINE_DIRECTION_IN;
+
+ mutex_unlock(&ts->lock);
+
+ return ret;
+}
+
int __max730x_probe(struct max7301 *ts)
{
struct device *dev = ts->dev;@@ -189,6 +214,7 @@ int __max730x_probe(struct max7301 *ts)
ts->chip.get = max7301_get;
ts->chip.direction_output = max7301_direction_output;
ts->chip.set = max7301_set;
+ ts->chip.get_direction = max7301_get_direction;
ts->chip.ngpio = PIN_NUMBER;
ts->chip.can_sleep = true;
--
2.54.0