[chrony-dev] [PATCH v3 2/2] rtc: extend check for RTCs that don't support interrupts

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


Several RTCs would only expose the broken behavior on enabling
interrupts. The reason for that is that the kernel only returns the
error if the state changes. Therefore the check has to probe
switch_interrupts(1) as well.

On platforms that work it will be switched on and off, while on those it
never works it will just stay off.

Clocks known to expose that behavior include, but are not limited to:
PPC64# dmesg | grep -i rtc   
[    0.241872] rtc-generic rtc-generic: registered as rtc0
[    0.270221] rtc-generic rtc-generic: setting system clock to ...
ARM64# dmesg | grep -i rtc
[    0.876198] rtc-efi rtc-efi: registered as rtc0
[    1.046869] rtc-efi rtc-efi: setting system clock to ...

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@xxxxxxxxxxxxx>
---
 rtc_linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rtc_linux.c b/rtc_linux.c
index aee768f..a44a912 100644
--- a/rtc_linux.c
+++ b/rtc_linux.c
@@ -516,7 +516,7 @@ RTC_Linux_Initialise(void)
   }
 
   /* Make sure the RTC supports interrupts */
-  if (!switch_interrupts(0)) {
+  if (!switch_interrupts(1) || !switch_interrupts(0)) {
     close(fd);
     return 0;
   }
-- 
2.24.0


-- 
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/