The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Michael Walle" <mwalle@kernel.org>
To: "Linus Walleij" <linusw@kernel.org>,
	"Bartosz Golaszewski" <brgl@kernel.org>
Cc: <linux-gpio@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	"Sashiko" <sashiko-bot@kernel.org>
Subject: Re: [PATCH v2 2/2] gpio: regmap: Don't set a fixed direction line
Date: Mon, 11 May 2026 09:24:00 +0200	[thread overview]
Message-ID: <DIFO1P3FCHRG.3DVOQS59PF7D6@kernel.org> (raw)
In-Reply-To: <20260508-regmap-gpio-sparse-fixed-dir-v2-2-deee84df3027@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 1349 bytes --]

Hi,

On Fri May 8, 2026 at 2:51 PM CEST, Linus Walleij wrote:
> If a GPIO line has a fixed direction, there is no point in
> trying to set the direction.
>
> This didn't happen much before because what we supported was
> all lines input or output and then the implementer would
> probably not specify the direction registers, but with
> sparse fixed direction we can have a mixture so let's take
> this into account.
>
> Suggested-by: Sashiko <sashiko-bot@kernel.org>
> Link: https://sashiko.dev/#/patchset/20260507-regmap-gpio-sparse-fixed-dir-v1-1-a2e5855e2701%40kernel.org
> Signed-off-by: Linus Walleij <linusw@kernel.org>
> ---
>  drivers/gpio/gpio-regmap.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
> index f45a432e8ebe..52a67dea8107 100644
> --- a/drivers/gpio/gpio-regmap.c
> +++ b/drivers/gpio/gpio-regmap.c
> @@ -203,6 +203,9 @@ static int gpio_regmap_set_direction(struct gpio_chip *chip,
>  	unsigned int base, val, reg, mask;
>  	int invert, ret;
>  
> +	if (gpio_regmap_fixed_direction(gpio, offset))
> +		return 0;
> +

Shall we check if the user wants to set an incorrect direction and
return -EINVAL?

-michael

>  	if (gpio->reg_dir_out_base) {
>  		base = gpio_regmap_addr(gpio->reg_dir_out_base);
>  		invert = 0;


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]

  reply	other threads:[~2026-05-11  7:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08 12:51 [PATCH v2 0/2] Improvement spotted during patch review Linus Walleij
2026-05-08 12:51 ` [PATCH v2 1/2] gpio: regmap: Support sparsed fixed direction Linus Walleij
2026-05-08 13:03   ` Alex Elder
2026-05-10 13:31     ` Alex Elder
2026-05-11  7:18   ` Michael Walle
2026-05-11 19:00     ` Linus Walleij
2026-05-08 12:51 ` [PATCH v2 2/2] gpio: regmap: Don't set a fixed direction line Linus Walleij
2026-05-11  7:24   ` Michael Walle [this message]
2026-05-11  9:56 ` [PATCH v2 0/2] Improvement spotted during patch review Bartosz Golaszewski
2026-05-11 12:15   ` Linus Walleij
2026-05-11 12:18     ` Alex Elder
2026-05-11 12:32 ` Bartosz Golaszewski
2026-05-11 12:39   ` Michael Walle
2026-05-11 12:44     ` Bartosz Golaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DIFO1P3FCHRG.3DVOQS59PF7D6@kernel.org \
    --to=mwalle@kernel.org \
    --cc=brgl@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashiko-bot@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox