Skip to content

Commit

Permalink
PM: sleep: Switch to rtc_time64_to_tm()/rtc_tm_to_time64()
Browse files Browse the repository at this point in the history
Call the 64bit versions of rtc_tm time conversion to avoid the y2038 issue.

Signed-off-by: Alexandre Belloni <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
alexandrebelloni authored and rafaeljw committed Dec 20, 2019
1 parent d1eef1c commit 2a2ef47
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/power/suspend_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down

0 comments on commit 2a2ef47

Please sign in to comment.