diff options
Diffstat (limited to 'drivers/staging/iio/meter/ade7854.c')
-rw-r--r-- | drivers/staging/iio/meter/ade7854.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/staging/iio/meter/ade7854.c b/drivers/staging/iio/meter/ade7854.c index 90d07cdca4b8..029c3bf42d4d 100644 --- a/drivers/staging/iio/meter/ade7854.c +++ b/drivers/staging/iio/meter/ade7854.c @@ -27,13 +27,13 @@ static ssize_t ade7854_read_8bit(struct device *dev, char *buf) { int ret; - u8 val = 0; + u32 val = 0; struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7854_state *st = iio_priv(indio_dev); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); - ret = st->read_reg_8(dev, this_attr->address, &val); - if (ret) + ret = st->read_reg(dev, this_attr->address, &val, 8); + if (ret < 0) return ret; return sprintf(buf, "%u\n", val); @@ -44,13 +44,13 @@ static ssize_t ade7854_read_16bit(struct device *dev, char *buf) { int ret; - u16 val = 0; + u32 val = 0; struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7854_state *st = iio_priv(indio_dev); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); - ret = st->read_reg_16(dev, this_attr->address, &val); - if (ret) + ret = st->read_reg(dev, this_attr->address, &val, 16); + if (ret < 0) return ret; return sprintf(buf, "%u\n", val); @@ -66,8 +66,8 @@ static ssize_t ade7854_read_24bit(struct device *dev, struct ade7854_state *st = iio_priv(indio_dev); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); - ret = st->read_reg_24(dev, this_attr->address, &val); - if (ret) + ret = st->read_reg(dev, this_attr->address, &val, 24); + if (ret < 0) return ret; return sprintf(buf, "%u\n", val); @@ -83,8 +83,8 @@ static ssize_t ade7854_read_32bit(struct device *dev, struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7854_state *st = iio_priv(indio_dev); - ret = st->read_reg_32(dev, this_attr->address, &val); - if (ret) + ret = st->read_reg(dev, this_attr->address, &val, 32); + if (ret < 0) return ret; return sprintf(buf, "%u\n", val); @@ -105,7 +105,7 @@ static ssize_t ade7854_write_8bit(struct device *dev, ret = kstrtou8(buf, 10, &val); if (ret) goto error_ret; - ret = st->write_reg_8(dev, this_attr->address, val); + ret = st->write_reg(dev, this_attr->address, val, 8); error_ret: return ret ? ret : len; @@ -126,7 +126,7 @@ static ssize_t ade7854_write_16bit(struct device *dev, ret = kstrtou16(buf, 10, &val); if (ret) goto error_ret; - ret = st->write_reg_16(dev, this_attr->address, val); + ret = st->write_reg(dev, this_attr->address, val, 16); error_ret: return ret ? ret : len; @@ -147,7 +147,7 @@ static ssize_t ade7854_write_24bit(struct device *dev, ret = kstrtou32(buf, 10, &val); if (ret) goto error_ret; - ret = st->write_reg_24(dev, this_attr->address, val); + ret = st->write_reg(dev, this_attr->address, val, 24); error_ret: return ret ? ret : len; @@ -168,7 +168,7 @@ static ssize_t ade7854_write_32bit(struct device *dev, ret = kstrtou32(buf, 10, &val); if (ret) goto error_ret; - ret = st->write_reg_32(dev, this_attr->address, val); + ret = st->write_reg(dev, this_attr->address, val, 32); error_ret: return ret ? ret : len; @@ -178,12 +178,12 @@ static int ade7854_reset(struct device *dev) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ade7854_state *st = iio_priv(indio_dev); - u16 val; + u32 val; - st->read_reg_16(dev, ADE7854_CONFIG, &val); + st->read_reg(dev, ADE7854_CONFIG, &val, 16); val |= BIT(7); /* Software Chip Reset */ - return st->write_reg_16(dev, ADE7854_CONFIG, val); + return st->write_reg(dev, ADE7854_CONFIG, val, 16); } static IIO_DEV_ATTR_AIGAIN(0644, @@ -415,8 +415,8 @@ static int ade7854_set_irq(struct device *dev, bool enable) int ret; u32 irqen; - ret = st->read_reg_32(dev, ADE7854_MASK0, &irqen); - if (ret) + ret = st->read_reg(dev, ADE7854_MASK0, &irqen, 32); + if (ret < 0) return ret; if (enable) @@ -426,7 +426,7 @@ static int ade7854_set_irq(struct device *dev, bool enable) else irqen &= ~BIT(17); - return st->write_reg_32(dev, ADE7854_MASK0, irqen); + return st->write_reg(dev, ADE7854_MASK0, irqen, 32); } static int ade7854_initial_setup(struct iio_dev *indio_dev) |