From: Xunlei Pang <xlpang@126.com>
To: linux-kernel@vger.kernel.org
Cc: rtc-linux@googlegroups.com,
Alessandro Zummo <a.zummo@towertech.it>,
John Stultz <john.stultz@linaro.org>,
Arnd Bergmann <arnd@arndb.de>,
Xunlei Pang <pang.xunlei@linaro.org>, CIH <cih@coventive.com>,
Nicolas Pitre <nico@fluxnic.net>,
Andrew Christian <andrew.christian@hp.com>,
Richard Purdie <rpurdie@rpsys.net>
Subject: [PATCH 5/5] drivers/rtc/sa1100: Replace deprecated rtc_tm_to_time() and rtc_time_to_tm()
Date: Wed, 15 Apr 2015 17:20:11 +0800 [thread overview]
Message-ID: <1429089611-29776-5-git-send-email-xlpang@126.com> (raw)
In-Reply-To: <1429089611-29776-1-git-send-email-xlpang@126.com>
From: Xunlei Pang <pang.xunlei@linaro.org>
The driver uses deprecated rtc_tm_to_time() and rtc_time_to_tm(),
which will overflow in year 2106 on 32-bit machines.
This patch solves this by:
- Replacing rtc_tm_to_time() with rtc_tm_to_time64()
- Replacing rtc_time_to_tm() with rtc_time64_to_tm()
Cc: CIH <cih@coventive.com>
Cc: Nicolas Pitre <nico@fluxnic.net>
Cc: Andrew Christian <andrew.christian@hp.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
drivers/rtc/rtc-sa1100.c | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c
index b6e1ca0..625a320 100644
--- a/drivers/rtc/rtc-sa1100.c
+++ b/drivers/rtc/rtc-sa1100.c
@@ -157,19 +157,14 @@ static int sa1100_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
static int sa1100_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
- rtc_time_to_tm(RCNR, tm);
+ rtc_time64_to_tm(RCNR, tm);
return 0;
}
static int sa1100_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
- unsigned long time;
- int ret;
-
- ret = rtc_tm_to_time(tm, &time);
- if (ret == 0)
- RCNR = time;
- return ret;
+ RCNR = rtc_tm_to_time64(tm);
+ return 0;
}
static int sa1100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
@@ -185,23 +180,17 @@ static int sa1100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
static int sa1100_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
struct sa1100_rtc *info = dev_get_drvdata(dev);
- unsigned long time;
- int ret;
spin_lock_irq(&info->lock);
- ret = rtc_tm_to_time(&alrm->time, &time);
- if (ret != 0)
- goto out;
RTSR = RTSR & (RTSR_HZE|RTSR_ALE|RTSR_AL);
- RTAR = time;
+ RTAR = rtc_tm_to_time64(&alrm->time);
if (alrm->enabled)
RTSR |= RTSR_ALE;
else
RTSR &= ~RTSR_ALE;
-out:
spin_unlock_irq(&info->lock);
- return ret;
+ return 0;
}
static int sa1100_rtc_proc(struct device *dev, struct seq_file *seq)
--
1.9.1
next prev parent reply other threads:[~2015-04-15 9:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-15 9:20 [PATCH 1/5] drivers/rtc/pcf8563: Replace deprecated rtc_time_to_tm() and rtc_tm_to_time() Xunlei Pang
2015-04-15 9:20 ` [PATCH 2/5] drivers/rtc/isl1208: Replace deprecated rtc_tm_to_time() Xunlei Pang
2015-04-15 9:20 ` [PATCH 3/5] drivers/rtc/sunxi: " Xunlei Pang
2015-04-15 9:20 ` [PATCH 4/5] drivers/rtc/pl030: Replace deprecated rtc_tm_to_time() and rtc_time_to_tm() Xunlei Pang
2015-04-15 9:35 ` Russell King - ARM Linux
2015-04-15 9:20 ` Xunlei Pang [this message]
2015-04-29 23:28 ` [5/5] drivers/rtc/sa1100: " Alexandre Belloni
[not found] ` <OF1F6D43BC.C38481A0-ON48257E54.004FA90B-48257E54.004FD9D8@LocalDomain>
[not found] ` <OF8AF02B38.A9E97627-ON48257E55.00352B8F-48257E55.0037661B@zte.com.cn>
2015-06-01 19:43 ` Arnd Bergmann
2015-06-01 19:59 ` Alexandre Belloni
2015-06-03 14:17 ` Alessandro Zummo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1429089611-29776-5-git-send-email-xlpang@126.com \
--to=xlpang@126.com \
--cc=a.zummo@towertech.it \
--cc=andrew.christian@hp.com \
--cc=arnd@arndb.de \
--cc=cih@coventive.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nico@fluxnic.net \
--cc=pang.xunlei@linaro.org \
--cc=rpurdie@rpsys.net \
--cc=rtc-linux@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®