]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
rtc: coh901331: switch to rtc_time64_to_tm/rtc_tm_to_time64
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Sun, 7 Apr 2019 21:10:25 +0000 (23:10 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 8 Apr 2019 12:40:05 +0000 (14:40 +0200)
Call the 64bit versions of rtc_tm time conversion now that the range is
enforced by the core.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-coh901331.c

index 5b214db919d0caf9ed420ef0d8325ad6281b7089..1fd743fefe289d7721bd507797b0406570678c00 100644 (file)
@@ -80,13 +80,14 @@ static int coh901331_read_time(struct device *dev, struct rtc_time *tm)
 
        clk_enable(rtap->clk);
        /* Check if the time is valid */
-       if (readl(rtap->virtbase + COH901331_VALID)) {
-               rtc_time_to_tm(readl(rtap->virtbase + COH901331_CUR_TIME), tm);
+       if (!readl(rtap->virtbase + COH901331_VALID)) {
                clk_disable(rtap->clk);
-               return 0;
+               return -EINVAL;
        }
+
+       rtc_time64_to_tm(readl(rtap->virtbase + COH901331_CUR_TIME), tm);
        clk_disable(rtap->clk);
-       return -EINVAL;
+       return 0;
 }
 
 static int coh901331_set_mmss(struct device *dev, unsigned long secs)
@@ -105,7 +106,7 @@ static int coh901331_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
        struct coh901331_port *rtap = dev_get_drvdata(dev);
 
        clk_enable(rtap->clk);
-       rtc_time_to_tm(readl(rtap->virtbase + COH901331_ALARM), &alarm->time);
+       rtc_time64_to_tm(readl(rtap->virtbase + COH901331_ALARM), &alarm->time);
        alarm->pending = readl(rtap->virtbase + COH901331_IRQ_EVENT) & 1U;
        alarm->enabled = readl(rtap->virtbase + COH901331_IRQ_MASK) & 1U;
        clk_disable(rtap->clk);
@@ -116,9 +117,8 @@ static int coh901331_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
 static int coh901331_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
 {
        struct coh901331_port *rtap = dev_get_drvdata(dev);
-       unsigned long time;
+       unsigned long time =  rtc_tm_to_time64(&alarm->time);
 
-       rtc_tm_to_time(&alarm->time, &time);
        clk_enable(rtap->clk);
        writel(time, rtap->virtbase + COH901331_ALARM);
        writel(alarm->enabled, rtap->virtbase + COH901331_IRQ_MASK);