Linux RTC
 help / color / mirror / Atom feed
* [rtc-linux] rtctest woes
@ 2015-09-16  7:15 Uwe Kleine-König
  2015-09-16  7:16 ` [PATCH] rtc: rtctest: enabling UIE for a chip that doesn't support it returns EINVAL Uwe Kleine-König
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2015-09-16  7:15 UTC (permalink / raw)
  To: Alexandre Belloni, rtc-linux; +Cc: Alessandro Zummo

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 rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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

* [PATCH] rtc: rtctest: enabling UIE for a chip that doesn't support it returns EINVAL
  2015-09-16  7:15 [rtc-linux] rtctest woes Uwe Kleine-König
@ 2015-09-16  7:16 ` Uwe Kleine-König
  2015-10-03 12:25   ` Alexandre Belloni
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2015-09-16  7:16 UTC (permalink / raw)
  To: Alexandre Belloni, rtc-linux; +Cc: Alessandro Zummo, kernel

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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 tools/testing/selftests/timers/rtctest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/timers/rtctest.c b/tools/testing/selftests/timers/rtctest.c
index d80ae852334d..624bce51b27d 100644
--- a/tools/testing/selftests/timers/rtctest.c
+++ b/tools/testing/selftests/timers/rtctest.c
@@ -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;
-- 
2.5.0

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

* Re: [PATCH] rtc: rtctest: enabling UIE for a chip that doesn't support it returns EINVAL
  2015-09-16  7:16 ` [PATCH] rtc: rtctest: enabling UIE for a chip that doesn't support it returns EINVAL Uwe Kleine-König
@ 2015-10-03 12:25   ` Alexandre Belloni
  0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2015-10-03 12:25 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: rtc-linux, Alessandro Zummo, kernel

On 16/09/2015 at 09:16:51 +0200, Uwe Kleine-König wrote :
> 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.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  tools/testing/selftests/timers/rtctest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
Applied, thanks.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

end of thread, other threads:[~2015-10-03 12:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-16  7:15 [rtc-linux] rtctest woes Uwe Kleine-König
2015-09-16  7:16 ` [PATCH] rtc: rtctest: enabling UIE for a chip that doesn't support it returns EINVAL Uwe Kleine-König
2015-10-03 12:25   ` Alexandre Belloni

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