Skip to content

Commit e09784a

Browse files
alexandrebelloniKAGA-KOKO
authored andcommitted
alarmtimer: Check RTC features instead of ops
RTC drivers used to leave .set_alarm() NULL in order to signal the RTC device doesn't support alarms. The drivers are now clearing the RTC_FEATURE_ALARM bit for that purpose in order to keep the rtc_class_ops structure const. So now, .set_alarm() is set unconditionally and this possibly causes the alarmtimer code to select an RTC device that doesn't support alarms. Test RTC_FEATURE_ALARM instead of relying on ops->set_alarm to determine whether alarms are available. Fixes: 7ae4122 ("rtc: introduce features bitfield") Signed-off-by: Alexandre Belloni <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent 6efb943 commit e09784a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/time/alarmtimer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static int alarmtimer_rtc_add_device(struct device *dev,
9292
if (rtcdev)
9393
return -EBUSY;
9494

95-
if (!rtc->ops->set_alarm)
95+
if (!test_bit(RTC_FEATURE_ALARM, rtc->features))
9696
return -1;
9797
if (!device_may_wakeup(rtc->dev.parent))
9898
return -1;

0 commit comments

Comments
 (0)