Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	linux-gpio@vger.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
	Anne Bezemer <j.a.bezemer@opensourcepartners.nl>
Subject: Re: [libgpiod][PATCH] core: remove buggy flags sanitization from line-config
Date: Thu, 4 Jan 2024 22:07:07 +0800	[thread overview]
Message-ID: <20240104140707.GA90369@rigel> (raw)
In-Reply-To: <20240104135058.46703-1-brgl@bgdev.pl>

On Thu, Jan 04, 2024 at 02:50:58PM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> We try to drop potentially set output flags from line config if edge
> detection is enabled but we use the library enum instead of the one from
> the uAPI. In any case, we should actually loudly complain if user tries
> to use the output mode with edge-detection (like we do currently) so just
> remove offending lines entirely.
>

I don't see any problem with that.
It also explains why we didn't pick it up earlier - it behaves as
expected and has no visible side effects, so this is just tidying up
dead code.

Reviewed-by: Kent Gibson <warthog618@gmail.com>

> Reported-by: Anne Bezemer <j.a.bezemer@opensourcepartners.nl>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
>  lib/line-config.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/lib/line-config.c b/lib/line-config.c
> index 2749a2a..9302c1b 100644
> --- a/lib/line-config.c
> +++ b/lib/line-config.c
> @@ -381,18 +381,15 @@ static uint64_t make_kernel_flags(struct gpiod_line_settings *settings)
>  	case GPIOD_LINE_EDGE_FALLING:
>  		flags |= (GPIO_V2_LINE_FLAG_EDGE_FALLING |
>  			  GPIO_V2_LINE_FLAG_INPUT);
> -		flags &= ~GPIOD_LINE_DIRECTION_OUTPUT;
>  		break;
>  	case GPIOD_LINE_EDGE_RISING:
>  		flags |= (GPIO_V2_LINE_FLAG_EDGE_RISING |
>  			  GPIO_V2_LINE_FLAG_INPUT);
> -		flags &= ~GPIOD_LINE_DIRECTION_OUTPUT;
>  		break;
>  	case GPIOD_LINE_EDGE_BOTH:
>  		flags |= (GPIO_V2_LINE_FLAG_EDGE_FALLING |
>  			  GPIO_V2_LINE_FLAG_EDGE_RISING |
>  			  GPIO_V2_LINE_FLAG_INPUT);
> -		flags &= ~GPIOD_LINE_DIRECTION_OUTPUT;
>  		break;
>  	default:
>  		break;
> --
> 2.40.1
>

  reply	other threads:[~2024-01-04 14:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-04 13:50 [libgpiod][PATCH] core: remove buggy flags sanitization from line-config Bartosz Golaszewski
2024-01-04 14:07 ` Kent Gibson [this message]
2024-01-04 20:19   ` J.A. Bezemer
2024-01-05  8:58 ` 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=20240104140707.GA90369@rigel \
    --to=warthog618@gmail.com \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=j.a.bezemer@opensourcepartners.nl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.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