Skip to content

Commit

Permalink
rtc: mv: let the core handle invalid alarms
Browse files Browse the repository at this point in the history
Instead of lying to the core when the alarm is invalid, let it handle that
by returning the error.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Tested-by: Gregory CLEMENT <gregory.clement@bootlin.com>  (on Armada 375 DB)
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
  • Loading branch information
Alexandre Belloni committed Oct 3, 2018
1 parent 89e27ce commit 959e8b7
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/rtc/rtc-mv.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,9 @@ static int mv_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
/* hw counts from year 2000, but tm_year is relative to 1900 */
alm->time.tm_year = bcd2bin(year) + 100;

if (rtc_valid_tm(&alm->time) < 0) {
dev_err(dev, "retrieved alarm date/time is not valid.\n");
rtc_time_to_tm(0, &alm->time);
}

alm->enabled = !!readl(ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS);
return 0;

return rtc_valid_tm(&alm->time);
}

static int mv_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
Expand Down

0 comments on commit 959e8b7

Please sign in to comment.