[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VeTyS_77LCp6Uab18M3hJ0dtf5jiSSrPN4tHaBHFEUTkg@mail.gmail.com>
Date: Wed, 13 Jul 2022 12:07:29 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Kent Gibson <warthog618@...il.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
Bartosz Golaszewski <brgl@...ev.pl>,
Linus Walleij <linus.walleij@...aro.org>,
Dipen Patel <dipenp@...dia.com>
Subject: Re: [PATCH 5/6] gpiolib: cdev: consolidate edge detector
configuration flags
On Wed, Jul 13, 2022 at 3:39 AM Kent Gibson <warthog618@...il.com> wrote:
>
> Combine the polarity_change flag, struct line eflags, and hte enable
> flag into a single flag variable.
>
> The combination of these flags describes the configuration state
> of the edge detector, so formalize and clarify that by combining
> them into a single variable, edflags, in struct line.
>
> The edflags is a subset of the GPIO_V2_LINE_FLAGsb relevant to
> the edge detector, and is also a superset of the eflags it replaces.
> The eflags name is still used to describe the subset of edflags
> corresponding to the rising/falling edge flags where edflags is
> masked down to that subset.
>
> This consolidation reduces the number of variables being passed,
> simplifies state comparisons, and provides a more extensible
> foundation should additional edge sources be integrated in the
> future.
I believe that you have checked this from a locking perspective, so we
won't have worse lock contamination, if any.
...
> struct linereq *lr;
> struct gpio_v2_line_event le;
> int level;
> - u64 eflags;
> + u64 edflags;
I would at the same time move it up before `int level;`.
...
> + int level = -1, diff_seqno;
> + u64 eflags, edflags = READ_ONCE(line->edflags);
Ditto.
...
> u32 debounce_period_us;
> unsigned long irqflags = 0;
> int irq, ret;
> + u64 eflags;
Ditto for similarity.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists