On Sat, Jul 25, 2020 at 6:21 AM Kent Gibson <warthog618@xxxxxxxxx> wrote: > > Add support for edge detection to lines requested using > GPIO_GET_LINE_IOCTL. > > Signed-off-by: Kent Gibson <warthog618@xxxxxxxxx> > --- [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