[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <re2izaxwbjp6hcms3cps4l4tfvwaxyt56gkc7ohrftcjizwkwt@jsjjo3b6xrcs>
Date: Fri, 19 Sep 2025 16:59:19 +0300
From: Ioana Ciornei <ioana.ciornei@....com>
To: Michael Walle <mwalle@...nel.org>
Cc: Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>,
Linus Walleij <linus.walleij@...aro.org>, Bartosz Golaszewski <brgl@...ev.pl>,
Shawn Guo <shawnguo@...nel.org>, Lee Jones <lee@...nel.org>, devicetree@...r.kernel.org,
linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org, Frank Li <Frank.Li@....com>
Subject: Re: [PATCH v4 06/11] gpio: regmap: add the .fixed_direction_output
configuration parameter
On Fri, Sep 19, 2025 at 03:41:00PM +0200, Michael Walle wrote:
> Hi,
>
> > @@ -129,6 +130,13 @@ static int gpio_regmap_get_direction(struct gpio_chip *chip,
> > unsigned int base, val, reg, mask;
> > int invert, ret;
> >
> > + if (gpio->fixed_direction_output) {
> > + if (test_bit(offset, gpio->fixed_direction_output))
> > + return GPIO_LINE_DIRECTION_OUT;
> > + else
> > + return GPIO_LINE_DIRECTION_IN;
> > + }
> > +
> > if (gpio->reg_dat_base && !gpio->reg_set_base)
> > return GPIO_LINE_DIRECTION_IN;
> > if (gpio->reg_set_base && !gpio->reg_dat_base)
> > @@ -277,6 +285,17 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
> > return ERR_PTR(ret);
>
> Not related to your patch, but this line above is wrong. That should
> be "goto err_free_gpio". Would you mind adding a patch for it? I
> could do it myself, but it will probably conflict with this series.
> I'm fine either way (if you do it, don't forget the Fixes: tag).
If this would be the only change, I would not do a v5. If there are more
things to change, of course.
>
> > }
> >
> > + if (config->fixed_direction_output) {
> > + gpio->fixed_direction_output = bitmap_alloc(chip->ngpio,
> > + GFP_KERNEL);
> > + if (!gpio->fixed_direction_output) {
> > + ret = -ENOMEM;
> > + goto err_free_gpio;
> > + }
> > + bitmap_copy(gpio->fixed_direction_output,
> > + config->fixed_direction_output, chip->ngpio);
> > + }
> > +
> > /* if not set, assume there is only one register */
> > gpio->ngpio_per_reg = config->ngpio_per_reg;
> > if (!gpio->ngpio_per_reg)
> > @@ -293,7 +312,7 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
> >
> > ret = gpiochip_add_data(chip, gpio);
> > if (ret < 0)
> > - goto err_free_gpio;
> > + goto err_free_bitmap;
>
> There's also an err_free_gpio jump below, that should also be
> replaced with err_free_bitmap.
I am a bit confused. With this patch applied there is only one 'goto
err_free_gpio' in gpio-regmap.c and that's the one added by me above.
What am I missing?
Ioana
Powered by blists - more mailing lists