* [PATCH 1/2] drivers/rtc/interface.c: Change rtc_set_mmss() to use time64_t
@ 2015-05-15 9:31 Xunlei Pang
2015-05-15 9:31 ` [PATCH 2/2] sparc: time: Provide update_persistent_clock64() Xunlei Pang
2015-05-15 23:46 ` [PATCH 1/2] drivers/rtc/interface.c: Change rtc_set_mmss() to use time64_t John Stultz
0 siblings, 2 replies; 3+ messages in thread
From: Xunlei Pang @ 2015-05-15 9:31 UTC (permalink / raw)
To: linux-kernel
Cc: rtc-linux, Alessandro Zummo, John Stultz, Arnd Bergmann,
David S. Miller, sparclinux, Xunlei Pang
From: Xunlei Pang <pang.xunlei@linaro.org>
rtc_set_mmss() uses "unsigned long" as its second parameter which
may have y2038 problem on 32-bit systems.
Change it to use time64_t.
All its call sites will be changed later(there are no problems
leaving these call sites untouched).
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
drivers/rtc/interface.c | 2 +-
include/linux/rtc.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index d43ee40..480ee3c 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -90,7 +90,7 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
}
EXPORT_SYMBOL_GPL(rtc_set_time);
-int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs)
+int rtc_set_mmss(struct rtc_device *rtc, time64_t secs)
{
int err;
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 8dcf682..9c3180e 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -161,7 +161,7 @@ extern void devm_rtc_device_unregister(struct device *dev,
extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm);
extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm);
-extern int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs);
+extern int rtc_set_mmss(struct rtc_device *rtc, time64_t secs);
extern int rtc_set_ntp_time(struct timespec64 now);
int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm);
extern int rtc_read_alarm(struct rtc_device *rtc,
--
1.9.1
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 2/2] sparc: time: Provide update_persistent_clock64()
2015-05-15 9:31 [PATCH 1/2] drivers/rtc/interface.c: Change rtc_set_mmss() to use time64_t Xunlei Pang
@ 2015-05-15 9:31 ` Xunlei Pang
2015-05-15 23:46 ` [PATCH 1/2] drivers/rtc/interface.c: Change rtc_set_mmss() to use time64_t John Stultz
1 sibling, 0 replies; 3+ messages in thread
From: Xunlei Pang @ 2015-05-15 9:31 UTC (permalink / raw)
To: linux-kernel
Cc: rtc-linux, Alessandro Zummo, John Stultz, Arnd Bergmann,
David S. Miller, sparclinux, Xunlei Pang
From: Xunlei Pang <pang.xunlei@linaro.org>
As part of addressing "y2038 problem" for in-kernel uses, this patch
converts update_persistent_clock() to update_persistent_clock64()
using timespec64 for both 32-bit and 64-bit sparc, since timekeeping
had already supported update_persistent_clock64().
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
arch/sparc/kernel/time_32.c | 27 ++++++++++-----------------
arch/sparc/kernel/time_64.c | 2 +-
2 files changed, 11 insertions(+), 18 deletions(-)
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index 18147a5..47b295f 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -65,8 +65,6 @@ DEFINE_PER_CPU(struct clock_event_device, sparc32_clockevent);
DEFINE_SPINLOCK(rtc_lock);
EXPORT_SYMBOL(rtc_lock);
-static int set_rtc_mmss(unsigned long);
-
unsigned long profile_pc(struct pt_regs *regs)
{
extern char __copy_user_begin[], __copy_user_end[];
@@ -87,9 +85,17 @@ EXPORT_SYMBOL(profile_pc);
volatile u32 __iomem *master_l10_counter;
-int update_persistent_clock(struct timespec now)
+int update_persistent_clock64(struct timespec64 now)
{
- return set_rtc_mmss(now.tv_sec);
+ struct rtc_device *rtc = rtc_class_open("rtc0");
+ int err = -1;
+
+ if (rtc) {
+ err = rtc_set_mmss(rtc, now.tv_sec);
+ rtc_class_close(rtc);
+ }
+
+ return err;
}
irqreturn_t notrace timer_interrupt(int dummy, void *dev_id)
@@ -362,16 +368,3 @@ void __init time_init(void)
sbus_time_init();
}
-
-static int set_rtc_mmss(unsigned long secs)
-{
- struct rtc_device *rtc = rtc_class_open("rtc0");
- int err = -1;
-
- if (rtc) {
- err = rtc_set_mmss(rtc, secs);
- rtc_class_close(rtc);
- }
-
- return err;
-}
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c
index edbbeb1..7c8f819 100644
--- a/arch/sparc/kernel/time_64.c
+++ b/arch/sparc/kernel/time_64.c
@@ -394,7 +394,7 @@ static struct sparc64_tick_ops hbtick_operations __read_mostly = {
static unsigned long timer_ticks_per_nsec_quotient __read_mostly;
-int update_persistent_clock(struct timespec now)
+int update_persistent_clock64(struct timespec64 now)
{
struct rtc_device *rtc = rtc_class_open("rtc0");
int err = -1;
--
1.9.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 1/2] drivers/rtc/interface.c: Change rtc_set_mmss() to use time64_t
2015-05-15 9:31 [PATCH 1/2] drivers/rtc/interface.c: Change rtc_set_mmss() to use time64_t Xunlei Pang
2015-05-15 9:31 ` [PATCH 2/2] sparc: time: Provide update_persistent_clock64() Xunlei Pang
@ 2015-05-15 23:46 ` John Stultz
1 sibling, 0 replies; 3+ messages in thread
From: John Stultz @ 2015-05-15 23:46 UTC (permalink / raw)
To: Xunlei Pang
Cc: lkml, rtc-linux, Alessandro Zummo, Arnd Bergmann,
David S. Miller, sparclinux, Xunlei Pang
On Fri, May 15, 2015 at 2:31 AM, Xunlei Pang <xlpang@126.com> wrote:
> From: Xunlei Pang <pang.xunlei@linaro.org>
>
> rtc_set_mmss() uses "unsigned long" as its second parameter which
> may have y2038 problem on 32-bit systems.
>
> Change it to use time64_t.
>
> All its call sites will be changed later(there are no problems
> leaving these call sites untouched).
This line isn't super convincing. Better to explain *why* there aren't
problems making this change first, rather then just asserting it, and
to give some confidence you'll address this, point out that sparc is
the only user of this funciton and will be updated by the following
patch in the series.
thanks
-john
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-05-15 23:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-15 9:31 [PATCH 1/2] drivers/rtc/interface.c: Change rtc_set_mmss() to use time64_t Xunlei Pang
2015-05-15 9:31 ` [PATCH 2/2] sparc: time: Provide update_persistent_clock64() Xunlei Pang
2015-05-15 23:46 ` [PATCH 1/2] drivers/rtc/interface.c: Change rtc_set_mmss() to use time64_t John Stultz
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®