Commit 5bed811d authored by Josh Cartwright's avatar Josh Cartwright Committed by Linus Torvalds

rtc: pm8xxx: fixup checkpatch/style issues

This patchset is based on Stephen Boyd's PM8921 modernization/cleanups
(http://lkml.kernel.org/g/1393441166-32692-1-git-send-email-sboyd@codeaurora.org),
and allows for this RTC driver to be usable again.

This patch (of 6):

Before performing additional cleanups to this driver, do the easy cleanups
first.
Signed-off-by: default avatarJosh Cartwright <joshc@codeaurora.org>
Reviewed-by: default avatarStephen Boyd <sboyd@codeaurora.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 131c9cc8
...@@ -128,13 +128,13 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm) ...@@ -128,13 +128,13 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm)
rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base, rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base,
1); 1);
if (rc < 0) { if (rc < 0) {
dev_err(dev, "Write to RTC control register " dev_err(dev, "Write to RTC control register failed\n");
"failed\n");
goto rtc_rw_fail; goto rtc_rw_fail;
} }
rtc_dd->ctrl_reg = ctrl_reg; rtc_dd->ctrl_reg = ctrl_reg;
} else } else {
spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags);
}
/* Write 0 to Byte[0] */ /* Write 0 to Byte[0] */
reg = 0; reg = 0;
...@@ -164,8 +164,7 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm) ...@@ -164,8 +164,7 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm)
rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base, rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base,
1); 1);
if (rc < 0) { if (rc < 0) {
dev_err(dev, "Write to RTC control register " dev_err(dev, "Write to RTC control register failed\n");
"failed\n");
goto rtc_rw_fail; goto rtc_rw_fail;
} }
rtc_dd->ctrl_reg = ctrl_reg; rtc_dd->ctrl_reg = ctrl_reg;
...@@ -204,7 +203,8 @@ static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm) ...@@ -204,7 +203,8 @@ static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm)
if (unlikely(reg < value[0])) { if (unlikely(reg < value[0])) {
rc = pm8xxx_read_wrapper(rtc_dd, value, rc = pm8xxx_read_wrapper(rtc_dd, value,
rtc_dd->rtc_read_base, NUM_8_BIT_RTC_REGS); rtc_dd->rtc_read_base,
NUM_8_BIT_RTC_REGS);
if (rc < 0) { if (rc < 0) {
dev_err(dev, "RTC read data register failed\n"); dev_err(dev, "RTC read data register failed\n");
return rc; return rc;
...@@ -252,8 +252,11 @@ static int pm8xxx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) ...@@ -252,8 +252,11 @@ static int pm8xxx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
} }
ctrl_reg = rtc_dd->ctrl_reg; ctrl_reg = rtc_dd->ctrl_reg;
ctrl_reg = alarm->enabled ? (ctrl_reg | PM8xxx_RTC_ALARM_ENABLE) :
(ctrl_reg & ~PM8xxx_RTC_ALARM_ENABLE); if (alarm->enabled)
ctrl_reg |= PM8xxx_RTC_ALARM_ENABLE;
else
ctrl_reg &= ~PM8xxx_RTC_ALARM_ENABLE;
rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base, 1); rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base, 1);
if (rc < 0) { if (rc < 0) {
...@@ -312,9 +315,13 @@ static int pm8xxx_rtc_alarm_irq_enable(struct device *dev, unsigned int enable) ...@@ -312,9 +315,13 @@ static int pm8xxx_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
u8 ctrl_reg; u8 ctrl_reg;
spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags); spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags);
ctrl_reg = rtc_dd->ctrl_reg; ctrl_reg = rtc_dd->ctrl_reg;
ctrl_reg = (enable) ? (ctrl_reg | PM8xxx_RTC_ALARM_ENABLE) :
(ctrl_reg & ~PM8xxx_RTC_ALARM_ENABLE); if (enable)
ctrl_reg |= PM8xxx_RTC_ALARM_ENABLE;
else
ctrl_reg &= ~PM8xxx_RTC_ALARM_ENABLE;
rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base, 1); rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base, 1);
if (rc < 0) { if (rc < 0) {
...@@ -354,8 +361,8 @@ static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id) ...@@ -354,8 +361,8 @@ static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id)
rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base, 1); rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base, 1);
if (rc < 0) { if (rc < 0) {
spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags);
dev_err(rtc_dd->rtc_dev, "Write to RTC control register " dev_err(rtc_dd->rtc_dev,
"failed\n"); "Write to RTC control register failed\n");
goto rtc_alarm_handled; goto rtc_alarm_handled;
} }
...@@ -366,8 +373,8 @@ static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id) ...@@ -366,8 +373,8 @@ static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id)
rc = pm8xxx_read_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base + rc = pm8xxx_read_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base +
PM8XXX_ALARM_CTRL_OFFSET, 1); PM8XXX_ALARM_CTRL_OFFSET, 1);
if (rc < 0) { if (rc < 0) {
dev_err(rtc_dd->rtc_dev, "RTC Alarm control register read " dev_err(rtc_dd->rtc_dev,
"failed\n"); "RTC Alarm control register read failed\n");
goto rtc_alarm_handled; goto rtc_alarm_handled;
} }
...@@ -375,8 +382,8 @@ static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id) ...@@ -375,8 +382,8 @@ static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id)
rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base + rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base +
PM8XXX_ALARM_CTRL_OFFSET, 1); PM8XXX_ALARM_CTRL_OFFSET, 1);
if (rc < 0) if (rc < 0)
dev_err(rtc_dd->rtc_dev, "Write to RTC Alarm control register" dev_err(rtc_dd->rtc_dev,
" failed\n"); "Write to RTC Alarm control register failed\n");
rtc_alarm_handled: rtc_alarm_handled:
return IRQ_HANDLED; return IRQ_HANDLED;
...@@ -436,14 +443,14 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev) ...@@ -436,14 +443,14 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base, rc = pm8xxx_write_wrapper(rtc_dd, &ctrl_reg, rtc_dd->rtc_base,
1); 1);
if (rc < 0) { if (rc < 0) {
dev_err(&pdev->dev, "Write to RTC control register " dev_err(&pdev->dev,
"failed\n"); "Write to RTC control register failed\n");
return rc; return rc;
} }
} }
rtc_dd->ctrl_reg = ctrl_reg; rtc_dd->ctrl_reg = ctrl_reg;
if (rtc_write_enable == true) if (rtc_write_enable)
pm8xxx_rtc_ops.set_time = pm8xxx_rtc_set_time; pm8xxx_rtc_ops.set_time = pm8xxx_rtc_set_time;
platform_set_drvdata(pdev, rtc_dd); platform_set_drvdata(pdev, rtc_dd);
...@@ -505,7 +512,9 @@ static int pm8xxx_rtc_suspend(struct device *dev) ...@@ -505,7 +512,9 @@ static int pm8xxx_rtc_suspend(struct device *dev)
} }
#endif #endif
static SIMPLE_DEV_PM_OPS(pm8xxx_rtc_pm_ops, pm8xxx_rtc_suspend, pm8xxx_rtc_resume); static SIMPLE_DEV_PM_OPS(pm8xxx_rtc_pm_ops,
pm8xxx_rtc_suspend,
pm8xxx_rtc_resume);
static struct platform_driver pm8xxx_rtc_driver = { static struct platform_driver pm8xxx_rtc_driver = {
.probe = pm8xxx_rtc_probe, .probe = pm8xxx_rtc_probe,
......
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