linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PM / sleep: check RTC features instead of ops in suspend_test
@ 2021-08-04 10:44 Alexandre Belloni
  2021-08-04 18:24 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Belloni @ 2021-08-04 10:44 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown, Pavel Machek
  Cc: Alexandre Belloni, linux-pm, linux-kernel

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;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] PM / sleep: check RTC features instead of ops in suspend_test
  2021-08-04 10:44 [PATCH] PM / sleep: check RTC features instead of ops in suspend_test Alexandre Belloni
@ 2021-08-04 18:24 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2021-08-04 18:24 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Rafael J. Wysocki, Len Brown, Pavel Machek, Linux PM,
	Linux Kernel Mailing List

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!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-04 18:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-04 10:44 [PATCH] PM / sleep: check RTC features instead of ops in suspend_test Alexandre Belloni
2021-08-04 18:24 ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).