Message ID | 20200421003135.23060-1-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v1,01/16] iio: adc: ad_sigma_delta: Use {get,put}_unaligned_be24() | expand |
> From: linux-iio-owner@vger.kernel.org <linux-iio-owner@vger.kernel.org> > On Behalf Of Andy Shevchenko > Sent: Dienstag, 21. April 2020 02:31 > To: Jonathan Cameron <jic23@kernel.org>; Peter Meerwald-Stadler > <pmeerw@pmeerw.net>; linux-iio@vger.kernel.org > Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>; Lars-Peter > Clausen <lars@metafoo.de>; Hennerich, Michael > <Michael.Hennerich@analog.com> > Subject: [PATCH v1 01/16] iio: adc: ad_sigma_delta: Use > {get,put}_unaligned_be24() > > > This makes the driver code slightly easier to read. > > Cc: Lars-Peter Clausen <lars@metafoo.de> > Cc: Michael Hennerich <Michael.Hennerich@analog.com> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > drivers/iio/adc/ad_sigma_delta.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > Acked-by: Nuno Sá <nuno.sa@analog.com>
On Tue, 21 Apr 2020 06:41:32 +0000 "Sa, Nuno" <Nuno.Sa@analog.com> wrote: > > From: linux-iio-owner@vger.kernel.org <linux-iio-owner@vger.kernel.org> > > On Behalf Of Andy Shevchenko > > Sent: Dienstag, 21. April 2020 02:31 > > To: Jonathan Cameron <jic23@kernel.org>; Peter Meerwald-Stadler > > <pmeerw@pmeerw.net>; linux-iio@vger.kernel.org > > Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>; Lars-Peter > > Clausen <lars@metafoo.de>; Hennerich, Michael > > <Michael.Hennerich@analog.com> > > Subject: [PATCH v1 01/16] iio: adc: ad_sigma_delta: Use > > {get,put}_unaligned_be24() > > > > > > This makes the driver code slightly easier to read. > > > > Cc: Lars-Peter Clausen <lars@metafoo.de> > > Cc: Michael Hennerich <Michael.Hennerich@analog.com> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > --- > > drivers/iio/adc/ad_sigma_delta.c | 8 ++------ > > 1 file changed, 2 insertions(+), 6 deletions(-) > > > > Acked-by: Nuno Sá <nuno.sa@analog.com> Applied to the togreg branch of iio.git and pushed out as testing etc etc. Jonathan
diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c index 8115b6de1d6c..dd3d54b3bc8b 100644 --- a/drivers/iio/adc/ad_sigma_delta.c +++ b/drivers/iio/adc/ad_sigma_delta.c @@ -70,9 +70,7 @@ int ad_sd_write_reg(struct ad_sigma_delta *sigma_delta, unsigned int reg, switch (size) { case 3: - data[1] = val >> 16; - data[2] = val >> 8; - data[3] = val; + put_unaligned_be24(val, &data[1]); break; case 2: put_unaligned_be16(val, &data[1]); @@ -157,9 +155,7 @@ int ad_sd_read_reg(struct ad_sigma_delta *sigma_delta, *val = get_unaligned_be32(sigma_delta->data); break; case 3: - *val = (sigma_delta->data[0] << 16) | - (sigma_delta->data[1] << 8) | - sigma_delta->data[2]; + *val = get_unaligned_be24(&sigma_delta->data[0]); break; case 2: *val = get_unaligned_be16(sigma_delta->data);
This makes the driver code slightly easier to read. Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Michael Hennerich <Michael.Hennerich@analog.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/iio/adc/ad_sigma_delta.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)