Using spi_w8r16be() will do the conversion of the result from big endian to
native endian in the helper function. This makes the code a bit smaller and also
keeps sparse happy. Fixes the following sparse warnings:
drivers/staging/iio/meter/
ade7753.c:97:29: warning: incorrect type in argument 1 (different base types)
drivers/staging/iio/meter/
ade7753.c:97:29: expected restricted __be16 const [usertype] *p
drivers/staging/iio/meter/
ade7753.c:97:29: got unsigned short [usertype] *val
drivers/staging/iio/meter/
ade7754.c:97:29: warning: incorrect type in argument 1 (different base types)
drivers/staging/iio/meter/
ade7754.c:97:29: expected restricted __be16 const [usertype] *p
drivers/staging/iio/meter/
ade7754.c:97:29: got unsigned short [usertype] *val
drivers/staging/iio/meter/
ade7759.c:97:29: warning: incorrect type in argument 1 (different base types)
drivers/staging/iio/meter/
ade7759.c:97:29: expected restricted __be16 const [usertype] *p
drivers/staging/iio/meter/
ade7759.c:97:29: got unsigned short [usertype] *val
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
struct ade7753_state *st = iio_priv(indio_dev);
ssize_t ret;
- ret = spi_w8r16(st->us, ADE7753_READ_REG(reg_address));
+ ret = spi_w8r16be(st->us, ADE7753_READ_REG(reg_address));
if (ret < 0) {
dev_err(&st->us->dev, "problem when reading 16 bit register 0x%02X",
reg_address);
}
*val = ret;
- *val = be16_to_cpup(val);
return 0;
}
struct ade7754_state *st = iio_priv(indio_dev);
int ret;
- ret = spi_w8r16(st->us, ADE7754_READ_REG(reg_address));
+ ret = spi_w8r16be(st->us, ADE7754_READ_REG(reg_address));
if (ret < 0) {
dev_err(&st->us->dev, "problem when reading 16 bit register 0x%02X",
reg_address);
}
*val = ret;
- *val = be16_to_cpup(val);
return 0;
}
struct ade7759_state *st = iio_priv(indio_dev);
int ret;
- ret = spi_w8r16(st->us, ADE7759_READ_REG(reg_address));
+ ret = spi_w8r16be(st->us, ADE7759_READ_REG(reg_address));
if (ret < 0) {
dev_err(&st->us->dev, "problem when reading 16 bit register 0x%02X",
reg_address);
}
*val = ret;
- *val = be16_to_cpup(val);
return 0;
}