Skip to content

Commit

Permalink
rtc: sysfs: check features instead of ops
Browse files Browse the repository at this point in the history
Test RTC_FEATURE_ALARM instead of relying on .set_alarm to know whether
alarms are available.

Signed-off-by: Alexandre Belloni <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
alexandrebelloni committed Apr 29, 2021
1 parent e463786 commit 4d0185e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/rtc/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 4d0185e

Please sign in to comment.