PM: sleep: check RTC features instead of ops in suspend_test
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 4 Aug 2021 10:44:07 +0000 (12:44 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 4 Aug 2021 18:23:05 +0000 (20:23 +0200)
Test RTC_FEATURE_ALARM instead of relying on ops->set_alarm to know whether
alarms are available.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
kernel/power/suspend_test.c

index e1ed58a..d20526c 100644 (file)
@@ -129,7 +129,7 @@ static int __init has_wakealarm(struct device *dev, const void *data)
 {
        struct rtc_device *candidate = to_rtc_device(dev);
 
-       if (!candidate->ops->set_alarm)
+       if (!test_bit(RTC_FEATURE_ALARM, candidate->features))
                return 0;
        if (!device_may_wakeup(candidate->dev.parent))
                return 0;