diff mbox

rtc: rtctest: enabling UIE for a chip that doesn't support it returns EINVAL

Message ID 1442387811-5384-1-git-send-email-u.kleine-koenig@pengutronix.de
State Accepted
Headers show

Commit Message

Uwe Kleine-König Sept. 16, 2015, 7:16 a.m. UTC
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(-)

Comments

Alexandre Belloni Oct. 3, 2015, 12:25 p.m. UTC | #1
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.
diff mbox

Patch

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;