+5
-3
drivers/rtc/interface.c
+5
-3
drivers/rtc/interface.c
···
265
265
return err;
266
266
267
267
/* full-function RTCs won't have such missing fields */
268
-
if (rtc_valid_tm(&alarm->time) == 0)
268
+
if (rtc_valid_tm(&alarm->time) == 0) {
269
+
rtc_add_offset(rtc, &alarm->time);
269
270
return 0;
271
+
}
270
272
271
273
/* get the "after" timestamp, to detect wrapped fields */
272
274
err = rtc_read_time(rtc, &now);
···
411
409
if (err)
412
410
return err;
413
411
414
-
rtc_subtract_offset(rtc, &alarm->time);
415
412
scheduled = rtc_tm_to_time64(&alarm->time);
416
413
417
414
/* Make sure we're not setting alarms in the past */
···
426
425
* the is alarm set for the next second and the second ticks
427
426
* over right here, before we set the alarm.
428
427
*/
428
+
429
+
rtc_subtract_offset(rtc, &alarm->time);
429
430
430
431
if (!rtc->ops)
431
432
err = -ENODEV;
···
470
467
471
468
mutex_unlock(&rtc->ops_lock);
472
469
473
-
rtc_add_offset(rtc, &alarm->time);
474
470
return err;
475
471
}
476
472
EXPORT_SYMBOL_GPL(rtc_set_alarm);