Re: [PATCH 5/6] gpiolib: cdev: consolidate edge detector configuration flags

From: Andy Shevchenko
Date: Wed Jul 13 2022 - 07:29:55 EST


On Wed, Jul 13, 2022 at 12:25 PM Kent Gibson <warthog618@xxxxxxxxx> wrote:
> On Wed, Jul 13, 2022 at 12:07:29PM +0200, Andy Shevchenko wrote:
> > On Wed, Jul 13, 2022 at 3:39 AM Kent Gibson <warthog618@xxxxxxxxx> wrote:

...

> > > struct linereq *lr;
> > > struct gpio_v2_line_event le;
> > > int level;
> > > - u64 eflags;
> > > + u64 edflags;
> >
> > I would at the same time move it up before `int level;`.
>
> Ok. What is the general rule you want applied, cos I'm not seeing it.

Common sense.
But here are two informal recommendations:
1) longer line first;
2) you may still group by struct, POD or other flavours (see below).

...

> > > + int level = -1, diff_seqno;
> > > + u64 eflags, edflags = READ_ONCE(line->edflags);
> >
> > Ditto.

Here is obviously the longer line case.

...

> > > u32 debounce_period_us;
> > > unsigned long irqflags = 0;
> > > int irq, ret;
> > > + u64 eflags;
> >
> > Ditto for similarity.

Here and in other cases above, swapping them won't interleave the
types grouping (like int-u64-int). But in some cases it's allowed when
you put the last definition in the block the definition of the
variable that keeps the returned value.

--
With Best Regards,
Andy Shevchenko