rtc: spear: stop validating rtc_time in .set_time and .set_alarm

The RTC core is always validating the rtc_time struct before calling
.set_time or .set_alarm. It is not necessary to do it again.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
Alexandre Belloni 2018-02-21 11:23:19 +01:00
parent 7ddc153d5f
commit 9fb7aa7501

View file

@ -170,18 +170,14 @@ static irqreturn_t spear_rtc_irq(int irq, void *dev_id)
} }
static int tm2bcd(struct rtc_time *tm) static void tm2bcd(struct rtc_time *tm)
{ {
if (rtc_valid_tm(tm) != 0)
return -EINVAL;
tm->tm_sec = bin2bcd(tm->tm_sec); tm->tm_sec = bin2bcd(tm->tm_sec);
tm->tm_min = bin2bcd(tm->tm_min); tm->tm_min = bin2bcd(tm->tm_min);
tm->tm_hour = bin2bcd(tm->tm_hour); tm->tm_hour = bin2bcd(tm->tm_hour);
tm->tm_mday = bin2bcd(tm->tm_mday); tm->tm_mday = bin2bcd(tm->tm_mday);
tm->tm_mon = bin2bcd(tm->tm_mon + 1); tm->tm_mon = bin2bcd(tm->tm_mon + 1);
tm->tm_year = bin2bcd(tm->tm_year); tm->tm_year = bin2bcd(tm->tm_year);
return 0;
} }
static void bcd2tm(struct rtc_time *tm) static void bcd2tm(struct rtc_time *tm)
@ -237,8 +233,7 @@ static int spear_rtc_set_time(struct device *dev, struct rtc_time *tm)
struct spear_rtc_config *config = dev_get_drvdata(dev); struct spear_rtc_config *config = dev_get_drvdata(dev);
unsigned int time, date; unsigned int time, date;
if (tm2bcd(tm) < 0) tm2bcd(tm);
return -EINVAL;
rtc_wait_not_busy(config); rtc_wait_not_busy(config);
time = (tm->tm_sec << SECOND_SHIFT) | (tm->tm_min << MINUTE_SHIFT) | time = (tm->tm_sec << SECOND_SHIFT) | (tm->tm_min << MINUTE_SHIFT) |
@ -295,8 +290,7 @@ static int spear_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
unsigned int time, date; unsigned int time, date;
int err; int err;
if (tm2bcd(&alm->time) < 0) tm2bcd(&alm->time);
return -EINVAL;
rtc_wait_not_busy(config); rtc_wait_not_busy(config);