Re: [PATCH v4 5/6] iio: imu: Add support for adis16475

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 7, 2020 at 12:26 PM Sa, Nuno <Nuno.Sa@xxxxxxxxxx> wrote:
>
> > From: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
> > Sent: Dienstag, 7. April 2020 11:19
> > To: Sa, Nuno <Nuno.Sa@xxxxxxxxxx>
> > Cc: linux-iio <linux-iio@xxxxxxxxxxxxxxx>; devicetree
> > <devicetree@xxxxxxxxxxxxxxx>; Jonathan Cameron <jic23@xxxxxxxxxx>;
> > Hartmut Knaack <knaack.h@xxxxxx>; Lars-Peter Clausen
> > <lars@xxxxxxxxxx>; Peter Meerwald-Stadler <pmeerw@xxxxxxxxxx>; Rob
> > Herring <robh+dt@xxxxxxxxxx>; Mark Rutland <mark.rutland@xxxxxxx>;
> > Ardelean, Alexandru <alexandru.Ardelean@xxxxxxxxxx>; Hennerich,
> > Michael <Michael.Hennerich@xxxxxxxxxx>
> > Subject: Re: [PATCH v4 5/6] iio: imu: Add support for adis16475

...

> > > > > +       for_each_set_bit(bit, indio_dev->active_scan_mask,
> > > > > +                        indio_dev->masklength) {
> > > >
> > > > One line?
> > > >
> > >
> > > It goes beyond 80 col limit... I know I could initialize these to some local
> > const but...
> >
> > That's why question mark is there.
> > Nonetheless, if it ~2-3 characters more, I would leave it on one line anyway.
> >
> > JFYI: readability has a priority over 80 limit.
> >
>
> Thanks! I would say it also depends on the maintainer (not sure)? Some are more
> strict about checkpatch...
> Btw, the line will have 84 if one liner...

Let's leave it to maintainer then.

> > > > > +       }

...

> > > > > +       irq_type = irqd_get_trigger_type(desc);
> > > > > +       if (irq_type == IRQF_TRIGGER_RISING) {
> >
> > > > > +               polarity = 1;
> >
> > For the sake of consistency I would assign irq_flag here as well.
> >
>
> The library will do it by default, But that's me using "inside" info... or maybe if
> I document that in patch 2 (the struct kernel docs) we would not really need to
> assign it here?

I see now. From my point of view the library here does an ill turn
because it hides some details which driver needs to do anyway.
I prefer explicit over implicit at least here.

I would say okay, if there is no such code (like below) would be
present in the driver.

> > > > > +       } else if (irq_type == IRQF_TRIGGER_FALLING) {
> > > > > +               polarity = 0;
> > > > > +               st->adis.irq_flag = IRQF_TRIGGER_FALLING;
> > > > > +       } else {
> > > > > +               dev_err(&spi->dev, "Invalid interrupt type 0x%x specified\n",
> > > > > +                       irq_type);
> > > > > +               return -EINVAL;
> > > > > +       }
> > > >
> > > > Here is the problem. You got type, but you compare it to flags. It's
> > > > not correct.
> > > > Although values are the same, the meaning is different.
> > > >
> > >
> > > Hmm, thanks! Honestly, this was copy paste from adis16480 and I never
> > realized this. I will
> > > use IRQ_TYPE_EDGE_RISING and IRQ_TYPE_EDGE_FALLING.

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux