On Wed, Dec 11, 2019 at 05:42:12PM +0100, Miroslav Lichvar wrote: > On Wed, Dec 11, 2019 at 04:13:23PM +0100, Christian Ehrhardt wrote: > > That means the first switch_interrupts call from RTC_Initialise -> > > RTC_Linux_Initialise -> switch_interrupts has on_off=0 and that doesn't > > trigger the issue at initialization phase. > > Later on on RTC_TimeInit -> switch_interrupts argument on_off=1 and the > > issue occurs. > > Turns out our "problematic" RTCs only trigger the issue on on_off=1. > > Interesting. When I added that code I checked the kernel source code > and it looked like enabling and disabling the interrupt should both > return the same error.
Looking at the kernel code more carefully, it seems it checks whether the state is changing before checking if UIE is actually supported, so switch_interrupts(0) would fail only if interrupts were already "enabled" (which they cannot be). Testing both, as you did in your patch, is the correct fix. -- Miroslav Lichvar -- To unsubscribe email chrony-dev-requ...@chrony.tuxfamily.org with "unsubscribe" in the subject. For help email chrony-dev-requ...@chrony.tuxfamily.org with "help" in the subject. Trouble? Email listmas...@chrony.tuxfamily.org.