On Tue, 20 Feb 2024 17:34:49 +0200 Dumitru Ceclan <mitrutzceclan@xxxxxxxxx> wrote: > Move gain-dB<->code conversion logic from read_raw and write_raw to > chip_info callbacks. > > Signed-off-by: Dumitru Ceclan <mitrutzceclan@xxxxxxxxx> I've made a small tweak whilst applying this one. > @@ -100,36 +155,15 @@ static int hmc425a_write_raw(struct iio_dev *indio_dev, > int val2, long mask) > { > mutex_lock(&st->lock); > switch (mask) { > case IIO_CHAN_INFO_HARDWAREGAIN: > + ret = gain_dB_to_code(st, val, val2, &code); > + if (ret) > + break; > st->gain = code; > - Check your patches for unrelated white space changes. They make things a little less reviewable and they create noise in the history etc. If you want to tidy up whitespace, a single patch just doing that is the way to go. > ret = hmc425a_write(indio_dev, st->gain); > break; > default: > @@ -189,6 +223,8 @@ static struct hmc425a_chip_info hmc425a_chip_info_tbl[] = { > .gain_min = -31500, > .gain_max = 0, > .default_gain = -0x40, /* set default gain -31.5db*/