lkml.org 
[lkml]   [2020]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 07/18] gpiolib: cdev: support edge detection for uAPI v2
On Sat, Jul 25, 2020 at 6:21 AM Kent Gibson <warthog618@gmail.com> wrote:
>
> Add support for edge detection to lines requested using
> GPIO_GET_LINE_IOCTL.
>
> Signed-off-by: Kent Gibson <warthog618@gmail.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

\
 
 \ /
  Last update: 2020-08-04 21:28    [W:0.237 / U:0.496 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site