[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Ve7TspiCredTu48AwstS4YUnfKTHzvuxvhq_-c9697igg@mail.gmail.com>
Date: Fri, 16 Oct 2020 17:24:14 +0300
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 <bgolaszewski@...libre.com>,
Linus Walleij <linus.walleij@...aro.org>
Subject: Re: [PATCH v2] gpiolib: cdev: document that line eflags are shared
On Wed, Oct 14, 2020 at 12:21 PM Kent Gibson <warthog618@...il.com> wrote:
>
> The line.eflags field is shared so document this fact and highlight it
> throughout using READ_ONCE() and WRITE_ONCE() accessors.
>
> Also use a local copy of the eflags in edge_irq_thread() to ensure
> consistent control flow even if eflags changes. This is only a defensive
> measure as edge_irq_thread() is currently disabled when the eflags are
> changed.
> - if (line->eflags == (GPIO_V2_LINE_FLAG_EDGE_RISING |
> - GPIO_V2_LINE_FLAG_EDGE_FALLING)) {
> + eflags = READ_ONCE(line->eflags);
> + if (eflags == (GPIO_V2_LINE_FLAG_EDGE_RISING |
> + GPIO_V2_LINE_FLAG_EDGE_FALLING)) {
Hmm... side note: perhaps at some point
#define GPIO_V2_LINE_FLAG_EDGE_BOTH \
(GPIO_V2_LINE_FLAG_EDGE_RISING | GPIO_V2_LINE_FLAG_EDGE_FALLING)
if (eflags == GPIO_V2_LINE_FLAG_EDGE_BOTH) {
?
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists