device-drivers/rtc: handle EINVAL on RTC_ALM_READ
PATCH 1/1 device-drivers/rtc: handle EINVAL on RTC_ALM_READ
Report TCONF result after RTC_ALM_READ fails with EINVAL and skip displaying the alarm time when this happens.
Signed-off-by Richard Palethorpe <[email protected]>
--- testcases/kernel/device-drivers/rtc/rtc01.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
testcases/kernel/device-drivers/rtc/rtc01.c +9 -4
@@ -108,12 +108,17 @@ void read_alarm_test(void)/*Read current alarm time */ ret =ioctl (rtc_fd,RTC_ALM_READ , &rtc_tm);if (ret ==-1 ) { -tst_resm (TFAIL |TERRNO ,"RTC_ALM_READ ioctl failed" ); -return ; +if (errno ==EINVAL ) { +tst_resm (TCONF |TERRNO ,"RTC_ALM_READ not suported" ); + }else { +tst_resm (TFAIL |TERRNO ,"RTC_ALM_READ ioctl failed" ); +return ; + } + }else { +tst_resm (TINFO ,"Alarm time set to %02d:%02d:%02d." , + rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec); } -tst_resm (TINFO ,"Alarm time set to %02d:%02d:%02d." , - rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec);/* Enable alarm interrupts */ ret =ioctl (rtc_fd,RTC_AIE_ON ,0 );if (ret ==-1 ) {
Signature · 1 line
2.10.0
PATCH 1/1 device-drivers/rtc: handle EINVAL on RTC_ALM_READ
Hi!
Pushed, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]