diff options
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-ds1374.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c index a5b0fc09f0c6..4d32e328f6cd 100644 --- a/drivers/rtc/rtc-ds1374.c +++ b/drivers/rtc/rtc-ds1374.c | |||
@@ -222,16 +222,16 @@ static int ds1374_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) | |||
222 | rtc_tm_to_time(&alarm->time, &new_alarm); | 222 | rtc_tm_to_time(&alarm->time, &new_alarm); |
223 | rtc_tm_to_time(&now, &itime); | 223 | rtc_tm_to_time(&now, &itime); |
224 | 224 | ||
225 | new_alarm -= itime; | ||
226 | |||
227 | /* This can happen due to races, in addition to dates that are | 225 | /* This can happen due to races, in addition to dates that are |
228 | * truly in the past. To avoid requiring the caller to check for | 226 | * truly in the past. To avoid requiring the caller to check for |
229 | * races, dates in the past are assumed to be in the recent past | 227 | * races, dates in the past are assumed to be in the recent past |
230 | * (i.e. not something that we'd rather the caller know about via | 228 | * (i.e. not something that we'd rather the caller know about via |
231 | * an error), and the alarm is set to go off as soon as possible. | 229 | * an error), and the alarm is set to go off as soon as possible. |
232 | */ | 230 | */ |
233 | if (new_alarm <= 0) | 231 | if (time_before_eq(new_alarm, itime)) |
234 | new_alarm = 1; | 232 | new_alarm = 1; |
233 | else | ||
234 | new_alarm -= itime; | ||
235 | 235 | ||
236 | mutex_lock(&ds1374->mutex); | 236 | mutex_lock(&ds1374->mutex); |
237 | 237 | ||