Re: [PATCH v5 08/11] iio: adc: hx711: localize loop iterators in hx711_read

Andy Shevchenko
2026-04-29T18:51:09Z

On Wed, Apr 29, 2026 at 05:01:35PM +0200, Joshua Crofts wrote:
> On Wed, 29 Apr 2026 at 07:48, Piyush Patle <piyushpatle228@gmail.com> wrote:

...

> > - for (i = 0; i < 24; i++) {
> > + for (unsigned int i = 0; i < 24; i++) {
>
> Might be a nitpick, but wouldn't it be better to have a macro or a local
> variable for the 24?

If so, should be a separate change. For now I don't mind to have it like this.

...

> > - for (i = 0; i < trailing_pulses; i++)
> > + for (unsigned int i = 0; i < trailing_pulses; i++)
>
> Why is the index unsigned when trailing_pulses is signed (this goes
> for the for loop above as well)?

It's probably me who suggested the unsigned variant. But I agree, better to
follow the type of the (upper) limit.

--
With Best Regards,
Andy Shevchenko