Commit 2a5654fe authored by Alexandre Belloni's avatar Alexandre Belloni

rtc: rv3029: use rtc_lock/rtc_unlock

Avoid accessing directly rtc->ops_lock and use the RTC core helpers.
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20210119220653.677750-11-alexandre.belloni@bootlin.com
parent a82430fd
...@@ -265,24 +265,23 @@ static irqreturn_t rv3029_handle_irq(int irq, void *dev_id) ...@@ -265,24 +265,23 @@ static irqreturn_t rv3029_handle_irq(int irq, void *dev_id)
{ {
struct device *dev = dev_id; struct device *dev = dev_id;
struct rv3029_data *rv3029 = dev_get_drvdata(dev); struct rv3029_data *rv3029 = dev_get_drvdata(dev);
struct mutex *lock = &rv3029->rtc->ops_lock;
unsigned int flags, controls; unsigned int flags, controls;
unsigned long events = 0; unsigned long events = 0;
int ret; int ret;
mutex_lock(lock); rtc_lock(rv3029->rtc);
ret = regmap_read(rv3029->regmap, RV3029_IRQ_CTRL, &controls); ret = regmap_read(rv3029->regmap, RV3029_IRQ_CTRL, &controls);
if (ret) { if (ret) {
dev_warn(dev, "Read IRQ Control Register error %d\n", ret); dev_warn(dev, "Read IRQ Control Register error %d\n", ret);
mutex_unlock(lock); rtc_unlock(rv3029->rtc);
return IRQ_NONE; return IRQ_NONE;
} }
ret = regmap_read(rv3029->regmap, RV3029_IRQ_FLAGS, &flags); ret = regmap_read(rv3029->regmap, RV3029_IRQ_FLAGS, &flags);
if (ret) { if (ret) {
dev_warn(dev, "Read IRQ Flags Register error %d\n", ret); dev_warn(dev, "Read IRQ Flags Register error %d\n", ret);
mutex_unlock(lock); rtc_unlock(rv3029->rtc);
return IRQ_NONE; return IRQ_NONE;
} }
...@@ -297,7 +296,7 @@ static irqreturn_t rv3029_handle_irq(int irq, void *dev_id) ...@@ -297,7 +296,7 @@ static irqreturn_t rv3029_handle_irq(int irq, void *dev_id)
regmap_write(rv3029->regmap, RV3029_IRQ_FLAGS, flags); regmap_write(rv3029->regmap, RV3029_IRQ_FLAGS, flags);
regmap_write(rv3029->regmap, RV3029_IRQ_CTRL, controls); regmap_write(rv3029->regmap, RV3029_IRQ_CTRL, controls);
} }
mutex_unlock(lock); rtc_unlock(rv3029->rtc);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment