On Sat, Jun 18, 2022 at 5:19 PM Jonathan Cameron <jic23@xxxxxxxxxx> wrote: > On Sat, 18 Jun 2022 02:13:16 +0200 > Jakob Hauser <jahau@xxxxxxxxxxxxxx> wrote: ... > > + for (i = 0; i < 17; i++) { > > Reduce indent by doing this as multiple loops. > Though even better if you can use bulk writes. > > int j = 0; > for (i = 0; i < 12; i++) { > ret = regmap_write(yas5xx->map, YAS537_MTC + i, > data[j++]) > if (ret) > return ret; > } > > for (i = 0; i < 4; i++) { > ret = regmap_write(yas5xx->map, YAS573_OFFSET_X + i, > data[j++]); > if (ret) > return ret; > } I guess you are referring to _noinc variants of regmap bulk operations. > > + if (i < 12) { > > + ret = regmap_write(yas5xx->map, > > + YAS537_MTC + i, > > + data[i]); > > + if (ret) > > + return ret; > > + } else if (i < 15) { > > + ret = regmap_write(yas5xx->map, > > + YAS537_OFFSET_X + i - 12, > > + data[i]); > > + if (ret) > > + return ret; > > + yas5xx->hard_offsets[i - 12] = data[i]; > > + } else { > > + ret = regmap_write(yas5xx->map, > > + YAS537_HCK + i - 15, > > + data[i]); > > + if (ret) > > + return ret; > > + } > > + } -- With Best Regards, Andy Shevchenko