diff options
Diffstat (limited to 'drivers/iio/dac/ad5504.c')
-rw-r--r-- | drivers/iio/dac/ad5504.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c index 1e6449346b5..581ec141de3 100644 --- a/drivers/iio/dac/ad5504.c +++ b/drivers/iio/dac/ad5504.c @@ -15,17 +15,16 @@ #include <linux/sysfs.h> #include <linux/regulator/consumer.h> #include <linux/module.h> +#include <linux/bitops.h> #include <linux/iio/iio.h> #include <linux/iio/sysfs.h> #include <linux/iio/events.h> #include <linux/iio/dac/ad5504.h> -#define AD5505_BITS 12 -#define AD5504_RES_MASK ((1 << (AD5505_BITS)) - 1) - -#define AD5504_CMD_READ (1 << 15) -#define AD5504_CMD_WRITE (0 << 15) +#define AD5504_RES_MASK GENMASK(11, 0) +#define AD5504_CMD_READ BIT(15) +#define AD5504_CMD_WRITE 0 #define AD5504_ADDR(addr) ((addr) << 12) /* Registers */ @@ -42,7 +41,7 @@ /** * struct ad5446_state - driver instance specific data - * @us: spi_device + * @spi: spi_device * @reg: supply regulator * @vref_mv: actual reference voltage used * @pwr_down_mask power down mask @@ -126,7 +125,6 @@ static int ad5504_write_raw(struct iio_dev *indio_dev, long mask) { struct ad5504_state *st = iio_priv(indio_dev); - int ret; switch (mask) { case IIO_CHAN_INFO_RAW: @@ -135,10 +133,8 @@ static int ad5504_write_raw(struct iio_dev *indio_dev, return ad5504_spi_write(st, chan->address, val); default: - ret = -EINVAL; + return -EINVAL; } - - return -EINVAL; } static const char * const ad5504_powerdown_modes[] = { |