diff options
author | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2019-03-13 01:30:44 +0300 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2019-03-18 05:36:01 +0300 |
commit | 8a941124458f20816dc864af4ff7c68d823670f6 (patch) | |
tree | 0313f02b566dd6fba988f6dc849e3358a454e694 /drivers/rtc/rtc-ab-b5ze-s3.c | |
parent | 5d049837dd765389159993a79fad4c853cba3433 (diff) | |
download | linux-8a941124458f20816dc864af4ff7c68d823670f6.tar.xz |
rtc: ab-b5ze-s3: switch to rtc_time64_to_tm/rtc_tm_to_time64
Call the 64bit versions of rtc_time_to_tm as the range is enforced by the
core.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-ab-b5ze-s3.c')
-rw-r--r-- | drivers/rtc/rtc-ab-b5ze-s3.c | 37 |
1 files changed, 9 insertions, 28 deletions
diff --git a/drivers/rtc/rtc-ab-b5ze-s3.c b/drivers/rtc/rtc-ab-b5ze-s3.c index 223e0124b087..398bb7b85a4d 100644 --- a/drivers/rtc/rtc-ab-b5ze-s3.c +++ b/drivers/rtc/rtc-ab-b5ze-s3.c @@ -332,9 +332,7 @@ static int _abb5zes3_rtc_read_timer(struct device *dev, return ret; /* ... convert to seconds ... */ - ret = rtc_tm_to_time(&rtc_tm, &rtc_secs); - if (ret) - return ret; + rtc_secs = rtc_tm_to_time64(&rtc_tm); /* ... add remaining timer A time ... */ ret = sec_from_timer_a(&timer_secs, regs[1], regs[2]); @@ -342,7 +340,7 @@ static int _abb5zes3_rtc_read_timer(struct device *dev, return ret; /* ... and convert back. */ - rtc_time_to_tm(rtc_secs + timer_secs, alarm_tm); + rtc_time64_to_tm(rtc_secs + timer_secs, alarm_tm); ret = regmap_read(data->regmap, ABB5ZES3_REG_CTRL2, ®); if (ret) { @@ -393,13 +391,8 @@ static int _abb5zes3_rtc_read_alarm(struct device *dev, alarm_tm->tm_year = rtc_tm.tm_year; alarm_tm->tm_mon = rtc_tm.tm_mon; - ret = rtc_tm_to_time(&rtc_tm, &rtc_secs); - if (ret) - return ret; - - ret = rtc_tm_to_time(alarm_tm, &alarm_secs); - if (ret) - return ret; + rtc_secs = rtc_tm_to_time64(&rtc_tm); + alarm_secs = rtc_tm_to_time64(alarm_tm); if (alarm_secs < rtc_secs) { if (alarm_tm->tm_mon == 11) { @@ -462,13 +455,8 @@ static int _abb5zes3_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) if (ret) return ret; - ret = rtc_tm_to_time(&rtc_tm, &rtc_secs); - if (ret) - return ret; - - ret = rtc_tm_to_time(alarm_tm, &alarm_secs); - if (ret) - return ret; + rtc_secs = rtc_tm_to_time64(&rtc_tm); + alarm_secs = rtc_tm_to_time64(alarm_tm); /* If alarm time is before current time, disable the alarm */ if (!alarm->enabled || alarm_secs <= rtc_secs) { @@ -487,9 +475,7 @@ static int _abb5zes3_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) rtc_tm.tm_mon += 1; } - ret = rtc_tm_to_time(&rtc_tm, &rtc_secs); - if (ret) - return ret; + rtc_secs = rtc_tm_to_time64(&rtc_tm); if (alarm_secs > rtc_secs) { dev_err(dev, "%s: alarm maximum is one month in the " @@ -574,13 +560,8 @@ static int abb5zes3_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) if (ret) return ret; - ret = rtc_tm_to_time(&rtc_tm, &rtc_secs); - if (ret) - return ret; - - ret = rtc_tm_to_time(alarm_tm, &alarm_secs); - if (ret) - return ret; + rtc_secs = rtc_tm_to_time64(&rtc_tm); + alarm_secs = rtc_tm_to_time64(alarm_tm); /* Let's first disable both the alarm and the timer interrupts */ ret = _abb5zes3_rtc_update_alarm(dev, false); |