On Wed, 29 Jul 2026 11:56:48 +0200, "Christophe Leroy (CS GROUP)" <[email protected]> said: > 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) <[email protected]> > --- > arch/powerpc/sysdev/cpm_common.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/arch/powerpc/sysdev/cpm_common.c > b/arch/powerpc/sysdev/cpm_common.c > index 07ea605ab0e6..b5d200e3ad68 100644 > --- a/arch/powerpc/sysdev/cpm_common.c > +++ b/arch/powerpc/sysdev/cpm_common.c > @@ -181,6 +181,18 @@ static int cpm2_gpio32_dir_in(struct gpio_chip *gc, > unsigned int gpio) > return 0; > } > > +static int cpm2_gpio32_get_direction(struct gpio_chip *gc, unsigned int gpio) > +{ > + struct cpm2_gpio32_chip *cpm2_gc = gpiochip_get_data(gc); > + struct cpm2_ioports __iomem *iop = cpm2_gc->regs; > + u32 pin_mask = 1 << (31 - gpio); > + > + if (in_be32(&iop->dir) & pin_mask) > + return GPIO_LINE_DIRECTION_OUT; > + > + return GPIO_LINE_DIRECTION_IN; > +} > + > int cpm2_gpiochip_add32(struct device *dev) > { > struct device_node *np = dev->of_node; > @@ -199,6 +211,7 @@ int cpm2_gpiochip_add32(struct device *dev) > gc->ngpio = 32; > gc->direction_input = cpm2_gpio32_dir_in; > gc->direction_output = cpm2_gpio32_dir_out; > + gc->get_direction = cpm2_gpio32_get_direction; > gc->get = cpm2_gpio32_get; > gc->set = cpm2_gpio32_set; > gc->parent = dev; > -- > 2.54.0 > >
Reviewed-by: Bartosz Golaszewski <[email protected]>
