rtctest woes
Subsystems (4)
Hello,
I'm running rtctest (i.e. tools/testing/selftests/timers/rtctest.c) against a pcf2127 i2c rtc. The driver doesn't have alarm support.
The first problem is that calling ioctl(fd, RTC_UIE_ON, 0) returns -1 and sets errno to EINVAL but rtctest expects ENOTTY if update irqs are not supported. (I'll send a patch in reply to this mail.)
Then with this issue fixed the next failure is at ioctl(fd, RTC_ALM_READ, &rtc_tm) after ioctl(fd, RTC_ALM_SET, &rtc_tm) succeeded. If I understand the code correctly the RTC_ALM_SET is emulated using kernel timers but ALM_GET is not. I'd say the right fix here is that RTC_ALM_SET should already fail in this case, but as I'm not sure I didn't create a patch.
BTW, asking scripts/get_maintainer.pl where to send a patch touching rtctest the reply includes the timekeeping and selftest maintainer entrys but not the rtc one. I suggest to move rtctest to tools/testing/selftests/rtc/rtctest.c.
Best regards
Uwe
--=20
Pengutronix e.K. | Uwe Kleine-K=C3=B6nig =
|
Industrial Linux Solutions | http://www.pengutronix.de/ |
--=20
--=20
You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---=20
You received this message because you are subscribed to the Google Groups "= rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to [email protected].
For more options, visit https://groups.google.com/d/optout.
PATCH 1/1 rtc: rtctest: enabling UIE for a chip that doesn't support it returns EINVAL
Calling ioctl(..., RTC_UIE_ON, ...) without CONFIG_RTC_INTF_DEV_UIE_EMUL either ends in rtc_update_irq_enable if rtc->uie_unsupported is true or in __rtc_set_alarm in the if (!rtc->ops->set_alarm) branch. In both cases the return value is -EINVAL. So check for that one instead of ENOTTY.
--- tools/testing/selftests/timers/rtctest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/timers/rtctest.c +1 -1
@@ -61,7 +61,7 @@ int main(int argc, char **argv)/* Turn on update interrupts (one per second) */ retval =ioctl (fd,RTC_UIE_ON ,0 );if (retval ==-1 ) { -if (errno ==ENOTTY ) { +if (errno ==EINVAL ) {fprintf (stderr,"\n...Update IRQs not supported.\n" ); goto test_READ;
Signature · 1 line
2.5.0
Alexandre Belloni
AppliedRe: [PATCH] rtc: rtctest: enabling UIE for a chip that doesn't support it returns EINVAL
Quoted 11 lines · Uwe Kleine-König
Calling
ioctl(..., RTC_UIE_ON, ...)withoutCONFIG_RTC_INTF_DEV_UIE_EMULeither ends inrtc_update_irq_enableifrtc->uie_unsupportedis true or in__rtc_set_alarmin the if (!rtc->ops->set_alarm) branch. In both cases the return value is-EINVAL. So check for that one instead of ENOTTY.Signed-off-by Uwe Kleine-König <[email protected]>--- tools/testing/selftests/timers/rtctest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks.
Signature · 3 lines
Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com