[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1497951359-13334-9-git-send-email-benjamin.gaignard@linaro.org>
Date: Tue, 20 Jun 2017 11:35:16 +0200
From: Benjamin Gaignard <benjamin.gaignard@...aro.org>
To: benjamin.gaignard@...aro.org
Cc: linaro-kernel@...ts.linaro.org,
Jason Cooper <jason@...edaemon.net>,
Gregory Clement <gregory.clement@...e-electrons.com>,
Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>,
Alessandro Zummo <a.zummo@...ertech.it>,
Alexandre Belloni <alexandre.belloni@...e-electrons.com>,
rtc-linux@...glegroups.com, linux-kernel@...r.kernel.org
Subject: [PATCH 08/51] rtc: armada38x: stop using rtc deprecated functions
rtc_time_to_tm() and rtc_tm_to_time() are deprecated because they
rely on 32bits variables and that will make rtc break in y2038/2016.
Stop using those two functions to safer 64bits ones.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@...aro.org>
CC: Jason Cooper <jason@...edaemon.net>
CC: Gregory Clement <gregory.clement@...e-electrons.com>
CC: Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>
CC: Alessandro Zummo <a.zummo@...ertech.it>
CC: Alexandre Belloni <alexandre.belloni@...e-electrons.com>
CC: rtc-linux@...glegroups.com
CC: linux-kernel@...r.kernel.org
---
drivers/rtc/rtc-armada38x.c | 34 ++++++++++++++--------------------
1 file changed, 14 insertions(+), 20 deletions(-)
diff --git a/drivers/rtc/rtc-armada38x.c b/drivers/rtc/rtc-armada38x.c
index 21f355c..752ebf4 100644
--- a/drivers/rtc/rtc-armada38x.c
+++ b/drivers/rtc/rtc-armada38x.c
@@ -213,13 +213,14 @@ static void armada8k_unmask_interrupt(struct armada38x_rtc *rtc)
static int armada38x_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
struct armada38x_rtc *rtc = dev_get_drvdata(dev);
- unsigned long time, flags;
+ unsigned long long time;
+ unsigned long flags;
spin_lock_irqsave(&rtc->lock, flags);
time = rtc->data->read_rtc_reg(rtc, RTC_TIME);
spin_unlock_irqrestore(&rtc->lock, flags);
- rtc_time_to_tm(time, tm);
+ rtc_time64_to_tm(time, tm);
return 0;
}
@@ -227,26 +228,23 @@ static int armada38x_rtc_read_time(struct device *dev, struct rtc_time *tm)
static int armada38x_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
struct armada38x_rtc *rtc = dev_get_drvdata(dev);
- int ret = 0;
- unsigned long time, flags;
-
- ret = rtc_tm_to_time(tm, &time);
+ unsigned long long time;
+ unsigned long flags;
- if (ret)
- goto out;
+ time = rtc_tm_to_time64(tm);
spin_lock_irqsave(&rtc->lock, flags);
rtc_delayed_write(time, rtc, RTC_TIME);
spin_unlock_irqrestore(&rtc->lock, flags);
-out:
- return ret;
+ return 0;
}
static int armada38x_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
struct armada38x_rtc *rtc = dev_get_drvdata(dev);
- unsigned long time, flags;
+ unsigned long long time;
+ unsigned long flags;
u32 reg = ALARM_REG(RTC_ALARM1, rtc->data->alarm);
u32 reg_irq = ALARM_REG(RTC_IRQ1_CONF, rtc->data->alarm);
u32 val;
@@ -259,7 +257,7 @@ static int armada38x_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
spin_unlock_irqrestore(&rtc->lock, flags);
alrm->enabled = val ? 1 : 0;
- rtc_time_to_tm(time, &alrm->time);
+ rtc_time64_to_tm(time, &alrm->time);
return 0;
}
@@ -269,13 +267,10 @@ static int armada38x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
struct armada38x_rtc *rtc = dev_get_drvdata(dev);
u32 reg = ALARM_REG(RTC_ALARM1, rtc->data->alarm);
u32 reg_irq = ALARM_REG(RTC_IRQ1_CONF, rtc->data->alarm);
- unsigned long time, flags;
- int ret = 0;
-
- ret = rtc_tm_to_time(&alrm->time, &time);
+ unsigned long long time;
+ unsigned long flags;
- if (ret)
- goto out;
+ time = rtc_tm_to_time64(&alrm->time);
spin_lock_irqsave(&rtc->lock, flags);
@@ -288,8 +283,7 @@ static int armada38x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
spin_unlock_irqrestore(&rtc->lock, flags);
-out:
- return ret;
+ return 0;
}
static int armada38x_rtc_alarm_irq_enable(struct device *dev,
--
1.9.1
Powered by blists - more mailing lists