Messages in this thread Patch in this message | | | From | Alexandre Belloni <> | Subject | [PATCH] alarmtimer: check RTC features instead of ops | Date | Thu, 29 Apr 2021 23:49:02 +0200 |
| |
Test RTC_FEATURE_ALARM instead of relying on ops->set_alarm to know whether alarms are available.
Fixes: 7ae41220ef58 ("rtc: introduce features bitfield") Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> --- Hello,
This doesn't seem much but this solve an issue where following a change in the RTC driver, this part of the code will think the RTC is alarm capable while it is not, then breaking the alarmtimer functionnality.
kernel/time/alarmtimer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index 98d7a15e8cf6..4d7a6dffa1e5 100644 --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c @@ -92,7 +92,7 @@ static int alarmtimer_rtc_add_device(struct device *dev, if (rtcdev) return -EBUSY; - if (!rtc->ops->set_alarm) + if (!test_bit(RTC_FEATURE_ALARM, rtc->features)) return -1; if (!device_may_wakeup(rtc->dev.parent)) return -1; -- 2.30.2
| |