File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -225,6 +225,23 @@ static inline bool is_leap_year(unsigned int year)
225
225
return (!(year % 4 ) && (year % 100 )) || !(year % 400 );
226
226
}
227
227
228
+ /**
229
+ * rtc_bound_alarmtime() - Return alarm time bound by rtc limit
230
+ * @rtc: Pointer to rtc device structure
231
+ * @requested: Requested alarm timeout
232
+ *
233
+ * Return: Alarm timeout bound by maximum alarm time supported by rtc.
234
+ */
235
+ static inline ktime_t rtc_bound_alarmtime (struct rtc_device * rtc ,
236
+ ktime_t requested )
237
+ {
238
+ if (rtc -> alarm_offset_max &&
239
+ rtc -> alarm_offset_max * MSEC_PER_SEC < ktime_to_ms (requested ))
240
+ return ms_to_ktime (rtc -> alarm_offset_max * MSEC_PER_SEC );
241
+
242
+ return requested ;
243
+ }
244
+
228
245
#define devm_rtc_register_device (device ) \
229
246
__devm_rtc_register_device(THIS_MODULE, device)
230
247
You can’t perform that action at this time.
0 commit comments