From: Kent Gibson <warthog618@gmail.com>
To: "J.A. Bezemer" <j.a.bezemer@opensourcepartners.nl>
Cc: linux-gpio@vger.kernel.org, brgl@bgdev.pl
Subject: Re: [libgpiod][PATCH] line-config.c: Fix library enum used for kernel flags bitfield
Date: Sun, 31 Dec 2023 09:57:27 +0800 [thread overview]
Message-ID: <20231231015727.GA3304@rigel> (raw)
In-Reply-To: <Pine.LNX.4.64.2312301347330.29540@wormhole.robuust.nl>
On Sat, Dec 30, 2023 at 01:48:53PM +0100, J.A. Bezemer wrote:
> Library enum was used to sanitize kernel flags.
>
Rephrase to make imperative and better describe what is being fixed.
e.g.
"Fix deselection of output direction when edge detection is selected in
make_kernel_flags(). Use correct flag to perform deselection rather than
a library enum."
If you do select both then the kernel will return an error when
the config is applied, so worst case outcome is a confusing errror.
> This will probably not have broken any "correct" usage: it would clear
> GPIO_V2_LINE_FLAG_USED, which is not used on setting, and
> GPIO_V2_LINE_FLAG_ACTIVE_LOW, which is set correctly later on.
>
It would be clearer to say there are no other visible side-effects, for
the reasons you list.
I'm just nitpicking the wording here - the patch itself looks good.
Well spotted.
Cheers,
Kent.
> Signed-off-by: Anne Bezemer <j.a.bezemer@opensourcepartners.nl>
> ---
> lib/line-config.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/line-config.c b/lib/line-config.c
> index 2749a2a..9bf7734 100644
> --- a/lib/line-config.c
> +++ b/lib/line-config.c
> @@ -381,18 +381,18 @@ 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;
> + flags &= ~GPIO_V2_LINE_FLAG_OUTPUT;
> break;
> case GPIOD_LINE_EDGE_RISING:
> flags |= (GPIO_V2_LINE_FLAG_EDGE_RISING |
> GPIO_V2_LINE_FLAG_INPUT);
> - flags &= ~GPIOD_LINE_DIRECTION_OUTPUT;
> + flags &= ~GPIO_V2_LINE_FLAG_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;
> + flags &= ~GPIO_V2_LINE_FLAG_OUTPUT;
> break;
> default:
> break;
> --
> 2.30.2
>
next prev parent reply other threads:[~2023-12-31 1:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-30 12:48 [libgpiod][PATCH] line-config.c: Fix library enum used for kernel flags bitfield J.A. Bezemer
2023-12-31 1:57 ` Kent Gibson [this message]
2023-12-31 2:02 ` Kent Gibson
2024-01-02 14:50 ` J.A. Bezemer
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=20231231015727.GA3304@rigel \
--to=warthog618@gmail.com \
--cc=brgl@bgdev.pl \
--cc=j.a.bezemer@opensourcepartners.nl \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.