mfd: Convert pcf50633 to use new register map API
PATCH 1/1 mfd: Convert pcf50633 to use new register map API
Signed-off-by Mark Brown <[email protected]>
--- drivers/mfd/Kconfig | 1 + drivers/mfd/pcf50633-core.c | 114 ++++++++++-------------------------- include/linux/mfd/pcf50633/core.h | 3 +- 3 files changed, 35 insertions(+), 83 deletions(-)
drivers/mfd/Kconfig +1 -0
@@ -500,6 +500,7 @@ config MFD_WM8994 config MFD_PCF50633 tristate "Support for NXP PCF50633" depends on I2C + select REGMAP_I2C help Say yes here if you have NXP PCF50633 chip on your board. This core driver provides register access and IRQ handling
drivers/mfd/pcf50633-core.c +32 -82
188 lines not on this page · raw message
include/linux/mfd/pcf50633/core.h +2 -1
@@ -21,6 +21,7 @@#include <linux/mfd/pcf50633/backlight.h> struct pcf50633 ; +struct regmap ;#define PCF50633_NUM_REGULATORS 11
@@ -134,7 +135,7 @@ enum {struct pcf50633 {struct device *dev; -struct i2c_client *i2c_client; +struct regmap *regmap;struct pcf50633_platform_data *pdata;int irq;
Signature · 1 line
1.7.5.4
Quoted 21 lines
/* Read a block of up to 32 regs */
int pcf50633_read_block(struct pcf50633 *pcf, u8 reg,drivers/mfd/pcf50633-core.c +1
-8int nr_regs, u8 *data) { - int ret; - -mutex_lock (&pcf->lock); - ret =__pcf50633_read (pcf, reg, nr_regs, data); -mutex_unlock (&pcf->lock); - -return ret; + return regmap_raw_read(pcf->regmap, reg, data, nr_regs); }EXPORT_SYMBOL_GPL (pcf50633_read_block);@@ -71,21 +42,22 @@ int pcf50633_write_block(struct pcf50633 *pcf , u8 reg, {int ret; -mutex_lock (&pcf->lock);
drivers/mfd/pcf50633-core.c int pcf50633_write_block(struct pcf50633 *pcf , u8 reg, · line 51
Quoted 10 lines
drivers/mfd/pcf50633-core.c +4
-3- ret =__pcf50633_write (pcf, reg, nr_regs, data); -mutex_unlock (&pcf->lock); + ret =regmap_raw_write (pcf->regmap, reg, data, nr_regs); +if (ret !=0 ) +return ret; -return ret; +return nr_regs; }EXPORT_SYMBOL_GPL (pcf50633_write_block);
We need to return the number of read regs in case of success for read_block too. (Actually we only need this for read_block, but I guess it is nice to be consistent here)
- Lars