diff options
author | Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> | 2018-03-23 11:26:41 -0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2018-03-24 13:25:59 +0000 |
commit | 259a8202b6fd2831868ad2069ec3ef3b808a26ad (patch) | |
tree | 4a466cba05d6d16d056056f1b9d0da75816b1360 /drivers/staging/iio/meter/ade7854.h | |
parent | 418bbb6e6ba2ec07ca2be2d6abba9fbad1809456 (diff) | |
download | linux-259a8202b6fd2831868ad2069ec3ef3b808a26ad.tar.bz2 |
staging:iio:ade7854: Remove write_reg_* duplications
This patch removes code duplications related to the write_reg_*
functions and centralizes them in a single function. Also, it eliminates
the legacy functions and replaces them by a unique signature that is
used by SPI and I2C.
Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/staging/iio/meter/ade7854.h')
-rw-r--r-- | drivers/staging/iio/meter/ade7854.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/staging/iio/meter/ade7854.h b/drivers/staging/iio/meter/ade7854.h index a82d38224cbd..290adbf56951 100644 --- a/drivers/staging/iio/meter/ade7854.h +++ b/drivers/staging/iio/meter/ade7854.h @@ -145,7 +145,8 @@ /** * struct ade7854_state - device instance specific data - * @spi: actual spi_device + * @spi: actual spi_device + * @write_reg Wrapper function for I2C and SPI write * @indio_dev: industrial I/O device structure * @buf_lock: mutex to protect tx and rx * @tx: transmit buffer @@ -158,10 +159,8 @@ struct ade7854_state { int (*read_reg_16)(struct device *dev, u16 reg_address, u16 *val); int (*read_reg_24)(struct device *dev, u16 reg_address, u32 *val); int (*read_reg_32)(struct device *dev, u16 reg_address, u32 *val); - int (*write_reg_8)(struct device *dev, u16 reg_address, u8 val); - int (*write_reg_16)(struct device *dev, u16 reg_address, u16 val); - int (*write_reg_24)(struct device *dev, u16 reg_address, u32 val); - int (*write_reg_32)(struct device *dev, u16 reg_address, u32 val); + int (*write_reg)(struct device *dev, u16 reg_address, u32 val, + int bits); int irq; struct mutex buf_lock; u8 tx[ADE7854_MAX_TX] ____cacheline_aligned; |