[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMpxmJW+RqW5=ugXru3ggRnLsPvtGEJ64_sBaY2GAXjeWT50qA@mail.gmail.com>
Date: Tue, 4 Aug 2020 21:28:04 +0200
From: Bartosz Golaszewski <bgolaszewski@...libre.com>
To: Kent Gibson <warthog618@...il.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
linux-gpio <linux-gpio@...r.kernel.org>,
Linus Walleij <linus.walleij@...aro.org>
Subject: Re: [PATCH v2 07/18] gpiolib: cdev: support edge detection for uAPI v2
On Sat, Jul 25, 2020 at 6:21 AM Kent Gibson <warthog618@...il.com> wrote:
>
> Add support for edge detection to lines requested using
> GPIO_GET_LINE_IOCTL.
>
> Signed-off-by: Kent Gibson <warthog618@...il.com>
> ---
[snip!]
> +
> +static irqreturn_t edge_irq_thread(int irq, void *p)
> +{
> + struct edge_detector *edet = p;
> + struct line *line = edet->line;
> + struct gpio_desc *desc = edge_detector_desc(edet);
> + struct gpioline_event le;
> + int ret;
> +
> + /* Do not leak kernel stack to userspace */
> + memset(&le, 0, sizeof(le));
> +
> + /*
> + * We may be running from a nested threaded interrupt in which case
> + * we didn't get the timestamp from edge_irq_handler().
> + */
> + if (!edet->timestamp) {
> + le.timestamp = ktime_get_ns();
IIRC Marc suggested using smp_rmw() here before reading the timestamp.
Do we still need it or something changed?
Bartosz
Powered by blists - more mailing lists