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

Joshua Crofts
2026-04-29T15:01:49Z

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?

> value <<= 1;
> ret = hx711_cycle(hx711_data);
> if (ret)
> @@ -174,7 +174,7 @@ static int hx711_read(struct hx711_data *hx711_data, int trailing_pulses)
>
> value ^= 0x800000;
>
> - 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)?

--
Kind regards

CJD