From 259a8202b6fd2831868ad2069ec3ef3b808a26ad Mon Sep 17 00:00:00 2001 From: Rodrigo Siqueira Date: Fri, 23 Mar 2018 11:26:41 -0300 Subject: 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 Signed-off-by: Jonathan Cameron --- drivers/staging/iio/meter/ade7854.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'drivers/staging/iio/meter/ade7854.h') 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; -- cgit v1.2.3