public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] alarmtimer: check RTC features instead of ops
@ 2021-04-29 21:49 Alexandre Belloni
  2021-04-30  7:16 ` Thomas Gleixner
  0 siblings, 1 reply; 7+ messages in thread
From: Alexandre Belloni @ 2021-04-29 21:49 UTC (permalink / raw)
  To: John Stultz, Thomas Gleixner, Stephen Boyd, Alexandre Belloni
  Cc: linux-kernel

Test RTC_FEATURE_ALARM instead of relying on ops->set_alarm to know whether
alarms are available.

Fixes: 7ae41220ef58 ("rtc: introduce features bitfield")
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
Hello,

This doesn't seem much but this solve an issue where following a change in the
RTC driver, this part of the code will think the RTC is alarm capable while it
is not, then breaking the alarmtimer functionnality.

 kernel/time/alarmtimer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index 98d7a15e8cf6..4d7a6dffa1e5 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -92,7 +92,7 @@ static int alarmtimer_rtc_add_device(struct device *dev,
 	if (rtcdev)
 		return -EBUSY;
 
-	if (!rtc->ops->set_alarm)
+	if (!test_bit(RTC_FEATURE_ALARM, rtc->features))
 		return -1;
 	if (!device_may_wakeup(rtc->dev.parent))
 		return -1;
-- 
2.30.2


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

end of thread, other threads:[~2021-05-08  0:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-29 21:49 [PATCH] alarmtimer: check RTC features instead of ops Alexandre Belloni
2021-04-30  7:16 ` Thomas Gleixner
2021-04-30  8:10   ` Alexandre Belloni
2021-04-30  8:59     ` Thomas Gleixner
2021-05-03 15:34       ` Alexandre Belloni
2021-05-03 18:00         ` Thomas Gleixner
2021-05-08  0:06           ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox