All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtc: pcf8563: clear RTC_FEATURE_ALARM if no irq
@ 2022-03-01 13:12 Vincent Whitchurch
  2022-11-16 22:13 ` Alexandre Belloni
  0 siblings, 1 reply; 2+ messages in thread
From: Vincent Whitchurch @ 2022-03-01 13:12 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni
  Cc: kernel, Vincent Whitchurch, linux-rtc, linux-kernel

If there is no IRQ hooked up, clear RTC_FEATURE_ALARM to make the core
ensure that userspace is made aware that alarms are not supported.

Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
---

Notes:
    Could there be some board which uses the RTC for wakeup using wakealarm but
    which doesn't have an IRQ?  Then this patch will stop it from working since
    wakealarm requires RTC_FEATURE_ALARM too.
    
    It's unclear how that needs to be addressed.  There seems to be a lot of
    variation in how different RTC drivers handle these flags.  Some call
    device_set_wakeup_capable(), either conditionally based on the irq or always,
    while others don't call it at all.  Some call dev_init_wakeup(), others don't.
    Some don't clear RTC_FEATURE_ALARM if wakeup-source is set, others don't check
    wakeup-source and only clear RTC_FEATURE_ALARM based on the irq.  Others never
    clear RTC_FEATURE_ALARM.

 drivers/rtc/rtc-pcf8563.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
index c8bddfb94129..ade3a564bd33 100644
--- a/drivers/rtc/rtc-pcf8563.c
+++ b/drivers/rtc/rtc-pcf8563.c
@@ -580,6 +580,8 @@ static int pcf8563_probe(struct i2c_client *client,
 								client->irq);
 			return err;
 		}
+	} else {
+		clear_bit(RTC_FEATURE_ALARM, pcf8563->rtc->features);
 	}
 
 	err = devm_rtc_register_device(pcf8563->rtc);
-- 
2.34.1


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

* Re: [PATCH] rtc: pcf8563: clear RTC_FEATURE_ALARM if no irq
  2022-03-01 13:12 [PATCH] rtc: pcf8563: clear RTC_FEATURE_ALARM if no irq Vincent Whitchurch
@ 2022-11-16 22:13 ` Alexandre Belloni
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2022-11-16 22:13 UTC (permalink / raw)
  To: Vincent Whitchurch, Alessandro Zummo; +Cc: linux-rtc, linux-kernel, kernel

On Tue, 1 Mar 2022 14:12:20 +0100, Vincent Whitchurch wrote:
> If there is no IRQ hooked up, clear RTC_FEATURE_ALARM to make the core
> ensure that userspace is made aware that alarms are not supported.
> 
> 

Applied, thanks!

[1/1] rtc: pcf8563: clear RTC_FEATURE_ALARM if no irq
      commit: 60cfac17d0a1c28cd41959e95ba1e0ecc47165e7

Best regards,

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

end of thread, other threads:[~2022-11-16 22:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01 13:12 [PATCH] rtc: pcf8563: clear RTC_FEATURE_ALARM if no irq Vincent Whitchurch
2022-11-16 22:13 ` Alexandre Belloni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.