On Mon, Jun 18, 2018 at 6:59 PM, Akinobu Mita <akinobu.mita@xxxxxxxxx> wrote: > Currently the address field in iio_chan_spec is filled with an accel > data register address for the corresponding axis. > > In preparation for adding calibration offset support, this makes use of > scan_index field to access accel data registers instead of using address > field. This change makes it easier to access both accel registers and > calibration offset registers with fewer lines of code as these are > located in X-axis, Y-axis, Z-axis order. > + ret = regmap_bulk_read(data->regmap, ADXL345_REG_DATAX0 + > + sizeof(regval) * chan->scan_index, > + ®val, sizeof(regval)); Can't we do something like #define ADXL345_REG_DATA_AXIS(si) (0x32 + (si) * sizeof(__le16)) instead and use where applicable? -- With Best Regards, Andy Shevchenko -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html