From: Alexandre Belloni Date: Thu, 29 Apr 2021 21:44:03 +0000 (+0200) Subject: rtc: sysfs: check features instead of ops X-Git-Tag: v5.13-rc1~64^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4d0185e67806a233c423c1668e87e137fbda192c;p=thirdparty%2Fkernel%2Flinux.git rtc: sysfs: check features instead of ops Test RTC_FEATURE_ALARM instead of relying on .set_alarm to know whether alarms are available. Signed-off-by: Alexandre Belloni Link: https://lore.kernel.org/r/20210429214403.2610952-1-alexandre.belloni@bootlin.com --- diff --git a/drivers/rtc/sysfs.c b/drivers/rtc/sysfs.c index 8a957d31a1a4a..74026f67fdfb0 100644 --- a/drivers/rtc/sysfs.c +++ b/drivers/rtc/sysfs.c @@ -273,7 +273,7 @@ static bool rtc_does_wakealarm(struct rtc_device *rtc) if (!device_can_wakeup(rtc->dev.parent)) return false; - return rtc->ops->set_alarm != NULL; + return !!test_bit(RTC_FEATURE_ALARM, rtc->features); } static umode_t rtc_attr_is_visible(struct kobject *kobj,