linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PM / sleep: switch to rtc_time64_to_tm/rtc_tm_to_time64
@ 2019-12-10 17:05 Alexandre Belloni
  2019-12-20  9:18 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Belloni @ 2019-12-10 17:05 UTC (permalink / raw)
  To: Rafael J . Wysocki
  Cc: Len Brown, Pavel Machek, linux-pm, linux-kernel,
	Alexandre Belloni

Call the 64bit versions of rtc_tm time conversion to avoid the y2038 issue.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 kernel/power/suspend_test.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/power/suspend_test.c b/kernel/power/suspend_test.c
index 60564b58de07..e1ed58adb69e 100644
--- a/kernel/power/suspend_test.c
+++ b/kernel/power/suspend_test.c
@@ -70,7 +70,7 @@ static void __init test_wakealarm(struct rtc_device *rtc, suspend_state_t state)
 	static char info_test[] __initdata =
 		KERN_INFO "PM: test RTC wakeup from '%s' suspend\n";
 
-	unsigned long		now;
+	time64_t		now;
 	struct rtc_wkalrm	alm;
 	int			status;
 
@@ -81,10 +81,10 @@ static void __init test_wakealarm(struct rtc_device *rtc, suspend_state_t state)
 		printk(err_readtime, dev_name(&rtc->dev), status);
 		return;
 	}
-	rtc_tm_to_time(&alm.time, &now);
+	now = rtc_tm_to_time64(&alm.time);
 
 	memset(&alm, 0, sizeof alm);
-	rtc_time_to_tm(now + TEST_SUSPEND_SECONDS, &alm.time);
+	rtc_time64_to_tm(now + TEST_SUSPEND_SECONDS, &alm.time);
 	alm.enabled = true;
 
 	status = rtc_set_alarm(rtc, &alm);
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] PM / sleep: switch to rtc_time64_to_tm/rtc_tm_to_time64
  2019-12-10 17:05 [PATCH] PM / sleep: switch to rtc_time64_to_tm/rtc_tm_to_time64 Alexandre Belloni
@ 2019-12-20  9:18 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2019-12-20  9:18 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: Len Brown, Pavel Machek, linux-pm, linux-kernel

On Tuesday, December 10, 2019 6:05:40 PM CET Alexandre Belloni wrote:
> Call the 64bit versions of rtc_tm time conversion to avoid the y2038 issue.
> 
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
>  kernel/power/suspend_test.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/power/suspend_test.c b/kernel/power/suspend_test.c
> index 60564b58de07..e1ed58adb69e 100644
> --- a/kernel/power/suspend_test.c
> +++ b/kernel/power/suspend_test.c
> @@ -70,7 +70,7 @@ static void __init test_wakealarm(struct rtc_device *rtc, suspend_state_t state)
>  	static char info_test[] __initdata =
>  		KERN_INFO "PM: test RTC wakeup from '%s' suspend\n";
>  
> -	unsigned long		now;
> +	time64_t		now;
>  	struct rtc_wkalrm	alm;
>  	int			status;
>  
> @@ -81,10 +81,10 @@ static void __init test_wakealarm(struct rtc_device *rtc, suspend_state_t state)
>  		printk(err_readtime, dev_name(&rtc->dev), status);
>  		return;
>  	}
> -	rtc_tm_to_time(&alm.time, &now);
> +	now = rtc_tm_to_time64(&alm.time);
>  
>  	memset(&alm, 0, sizeof alm);
> -	rtc_time_to_tm(now + TEST_SUSPEND_SECONDS, &alm.time);
> +	rtc_time64_to_tm(now + TEST_SUSPEND_SECONDS, &alm.time);
>  	alm.enabled = true;
>  
>  	status = rtc_set_alarm(rtc, &alm);
> 

Applied (with a slightly modified changelog) as 5.6 material, thanks!





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-20  9:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-10 17:05 [PATCH] PM / sleep: switch to rtc_time64_to_tm/rtc_tm_to_time64 Alexandre Belloni
2019-12-20  9:18 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).