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

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

 



On Wed, Apr 1, 2020 at 5:18 PM Sa, Nuno <Nuno.Sa@xxxxxxxxxx> wrote:
>
> > From: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
> > Sent: Mittwoch, 1. April 2020 16:06
> > 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 v3 5/6] iio: imu: Add support for adis16475
> >
> > On Wed, Apr 1, 2020 at 4:27 PM Sa, Nuno <Nuno.Sa@xxxxxxxxxx> wrote:
> > > > On Wed, Apr 1, 2020 at 10:13 AM Sa, Nuno <Nuno.Sa@xxxxxxxxxx>
> > wrote:
> > > > > > On Tue, Mar 31, 2020 at 2:49 PM Nuno Sá <nuno.sa@xxxxxxxxxx>
> > wrote:

...

> > > Well, I can remove the 7. I honestly took it from another driver and I guess
> > the idea
> > > is to make explicit that 7 is not supported. Since this is a 3 bit field and the
> > datasheet
> > > does not state this directly.
> > >
> > > As for the >=0, I prefer to have either as is or >0 since we don't really need to
> > check the
> > > index 0. If 1 fails, then we will use 0 either way...
> >
> > It makes sense to check to get better optimization (and increased readability).
> > Look for this
> >
> > i = ARRAY_SIZE(...);
> >
> > while (i--) {
> >  ...
> > }
> >
> > It's much better to read and understand.
>
> Well, about the readability it's a bit subjective . It depends who is
> reading the code. Just curious, how would you get better optimization
> by doing >=0 instead of > 0?

Feel the difference while (i--) vs. while (--i > 0).
The latter one is a bit unusual.

> Either way, I don’t have any strong feeling about this so I can do as
> you suggest.



-- 
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