Re: [PATCH v3] iio: accel: sca3000: replace usages of internal read data helpers by spi helpers

From: Andrew Ijano
Date: Sun May 11 2025 - 13:23:47 EST


Going back to this one to reply to the unaddressed comments.

On Fri, May 9, 2025 at 6:06 AM Andy Shevchenko
<andy.shevchenko@xxxxxxxxx> wrote:
>
...
>
> > chan->scan_type.shift,
>
> With the above done, move this parameter to the previous line.

Ok! I reorganized this shift operation to be all in one line.

...
>
> > - *val = (be16_to_cpup((__be16 *)st->rx) >>
> > + *val = (be16_to_cpu((__be16) ret) >>
> > chan->scan_type.shift) &
> > GENMASK(chan->scan_type.realbits - 1, 0);
>
> Ditto.

Thanks, I changed here too.
...

> > - else if (!state && (st->rx[0] & SCA3000_REG_MODE_FREE_FALL_DETECT))
> > + else if (!state && (ret & SCA3000_REG_MODE_FREE_FALL_DETECT))
>
> Remove redundant 'else'
>
> > return sca3000_write_reg(st, SCA3000_REG_MODE_ADDR,
> > - st->rx[0] & ~SCA3000_REG_MODE_FREE_FALL_DETECT);
> > + ret & ~SCA3000_REG_MODE_FREE_FALL_DETECT);
> > else
>
> Ditto.
Ok! Removed both of them.

...
>
> > ret = sca3000_write_reg(st, SCA3000_REG_MODE_ADDR,
> > - (st->rx[0] & SCA3000_MODE_PROT_MASK));
> > + (ret & SCA3000_MODE_PROT_MASK));
>
> Remove unneeded parentheses.
...
>
> > ret = sca3000_write_reg(st, SCA3000_REG_INT_MASK_ADDR,
>
> > - (st->rx[0] &
> > + (ret &
> > ~(SCA3000_REG_INT_MASK_RING_THREE_QUARTER |
> > SCA3000_REG_INT_MASK_RING_HALF |
> > SCA3000_REG_INT_MASK_ALL_INTS)));
>
> Remove unneeded parentheses (outer for the last parameter).
Great! Removed all the unneeded parentheses then.

--
Thanks again for these comments,
Andrew