diff options
Diffstat (limited to 'drivers/rtc/rtc-rv3029c2.c')
-rw-r--r-- | drivers/rtc/rtc-rv3029c2.c | 26 |
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; |