On Thu, Sep 03, 2020 at 09:55:22AM +0200, Bartosz Golaszewski wrote:
> On Mon, Aug 31, 2020 at 5:22 AM Kent Gibson <warthog...@gmail.com> wrote:
> >
> > Add support for edge detection to lines requested using
> > GPIO_V2_GET_LINE_IOCTL.
> >
> > The edge_detector implementation is based on the v1 lineevent
> > implementation.
> >

[snip]

> > +        * close in time as possible to the actual event.
> > +        */
> > +       line->timestamp = ktime_get_ns();
> > +
> > +       if (lr->num_lines != 1)
> > +               line->req_seqno = atomic_inc_return(&lr->seqno);
> 
> Do we never increase req_seqno for a single line?
> 

For a single line we just use line_seqno for both to avoid the
atomic_inc here and so reduce the time spent in the ISR and any
SMP sync overheads.

As per the comment in struct linereq:
 * @seqno: the sequence number for edge events generated on all lines in
 * this line request.  Note that this is not used when @num_lines is 1, as
 * the line_seqno is then the same and is cheaper to calculate.

Cheers,
Kent.

Reply via email to