summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2019-12-14 23:10:09 +0100
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2019-12-18 10:37:51 +0100
commit609e97fe31a4d1acf7bc0411277e43a4de13db44 (patch)
tree96409160959f4b4645edfbf7aac12ba321d5099f /drivers
parentc509e4344bc0e2505a635ee8ac948298c7f21127 (diff)
rtc: rv3029: remove open coded regmap_update_bits
rv3029_update_bits open codes regmap_update_bits and forgets to properly lock the register range while doing so. Use regmap_update_bits instead. Link: https://lore.kernel.org/r/20191214221022.622482-4-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/rtc/rtc-rv3029c2.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c
index 09433d4a86e3..9a0397f3dee9 100644
--- a/drivers/rtc/rtc-rv3029c2.c
+++ b/drivers/rtc/rtc-rv3029c2.c
@@ -137,23 +137,6 @@ static int rv3029_write_regs(struct device *dev, u8 reg, u8 const buf[],
return regmap_bulk_write(rv3029->regmap, reg, buf, len);
}
-static int rv3029_update_bits(struct device *dev, u8 reg, u8 mask, u8 set)
-{
- u8 buf;
- int ret;
-
- ret = rv3029_read_regs(dev, reg, &buf, 1);
- if (ret < 0)
- return ret;
- buf &= ~mask;
- buf |= set & mask;
- ret = rv3029_write_regs(dev, reg, &buf, 1);
- if (ret < 0)
- return ret;
-
- return 0;
-}
-
static int rv3029_get_sr(struct device *dev, u8 *buf)
{
int ret = rv3029_read_regs(dev, RV3029_STATUS, buf, 1);
@@ -200,14 +183,17 @@ static int rv3029_eeprom_busywait(struct device *dev)
static int rv3029_eeprom_exit(struct device *dev)
{
+ struct rv3029_data *rv3029 = dev_get_drvdata(dev);
+
/* Re-enable eeprom refresh */
- return rv3029_update_bits(dev, RV3029_ONOFF_CTRL,
+ return regmap_update_bits(rv3029->regmap, RV3029_ONOFF_CTRL,
RV3029_ONOFF_CTRL_EERE,
RV3029_ONOFF_CTRL_EERE);
}
static int rv3029_eeprom_enter(struct device *dev)
{
+ struct rv3029_data *rv3029 = dev_get_drvdata(dev);
int ret;
u8 sr;
@@ -236,8 +222,8 @@ static int rv3029_eeprom_enter(struct device *dev)
}
/* Disable eeprom refresh. */
- ret = rv3029_update_bits(dev, RV3029_ONOFF_CTRL, RV3029_ONOFF_CTRL_EERE,
- 0);
+ ret = regmap_update_bits(rv3029->regmap, RV3029_ONOFF_CTRL,
+ RV3029_ONOFF_CTRL_EERE, 0);
if (ret < 0)
return ret;