[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DCWTIV3281OX.1N3AA8K3T21LY@kernel.org>
Date: Fri, 19 Sep 2025 15:41:00 +0200
From: "Michael Walle" <mwalle@...nel.org>
To: "Ioana Ciornei" <ioana.ciornei@....com>, "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>
Cc: "Frank Li" <Frank.Li@....com>
Subject: Re: [PATCH v4 06/11] gpio: regmap: add the .fixed_direction_output
configuration parameter
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 (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.
Otherwise looks good.
-michael
Download attachment "signature.asc" of type "application/pgp-signature" (298 bytes)
Powered by blists - more mailing lists