Message ID | 20200421003135.23060-10-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 |
On Tue, 21 Apr 2020 03:31:29 +0300 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > This makes the driver code slightly easier to read. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Applied with asm/unaligned.h include added. J > --- > drivers/iio/light/zopt2201.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iio/light/zopt2201.c b/drivers/iio/light/zopt2201.c > index 5f54f39e7a4c..0df45b42c091 100644 > --- a/drivers/iio/light/zopt2201.c > +++ b/drivers/iio/light/zopt2201.c > @@ -219,7 +219,7 @@ static int zopt2201_read(struct zopt2201_data *data, u8 reg) > goto fail; > mutex_unlock(&data->lock); > > - return (buf[2] << 16) | (buf[1] << 8) | buf[0]; > + return get_unaligned_le24(&buf[0]); > > fail: > mutex_unlock(&data->lock);
diff --git a/drivers/iio/light/zopt2201.c b/drivers/iio/light/zopt2201.c index 5f54f39e7a4c..0df45b42c091 100644 --- a/drivers/iio/light/zopt2201.c +++ b/drivers/iio/light/zopt2201.c @@ -219,7 +219,7 @@ static int zopt2201_read(struct zopt2201_data *data, u8 reg) goto fail; mutex_unlock(&data->lock); - return (buf[2] << 16) | (buf[1] << 8) | buf[0]; + return get_unaligned_le24(&buf[0]); fail: mutex_unlock(&data->lock);
This makes the driver code slightly easier to read. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/iio/light/zopt2201.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)