diff mbox series

PM / sleep: check RTC features instead of ops in suspend_test

Message ID 20210804104407.5600-1-alexandre.belloni@bootlin.com
State Accepted
Commit 4fac49fd0a349aa3afb3ad7ec778a00592c7ab59
Headers show
Series PM / sleep: check RTC features instead of ops in suspend_test | expand

Commit Message

Alexandre Belloni Aug. 4, 2021, 10:44 a.m. UTC
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>
---
 kernel/power/suspend_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rafael J. Wysocki Aug. 4, 2021, 6:24 p.m. UTC | #1
On Wed, Aug 4, 2021 at 12:44 PM Alexandre Belloni
<alexandre.belloni@bootlin.com> wrote:
>
> 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>
> ---
>  kernel/power/suspend_test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/power/suspend_test.c b/kernel/power/suspend_test.c
> index e1ed58adb69e..d20526c5be15 100644
> --- a/kernel/power/suspend_test.c
> +++ b/kernel/power/suspend_test.c
> @@ -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;
> --

Applied as 5.15 material, thanks!
diff mbox series

Patch

diff --git a/kernel/power/suspend_test.c b/kernel/power/suspend_test.c
index e1ed58adb69e..d20526c5be15 100644
--- a/kernel/power/suspend_test.c
+++ b/kernel/power/suspend_test.c
@@ -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;