Skip to contentSkip to conversation

device-drivers/rtc: handle EINVAL on RTC_ALM_READ

PATCH New Richard Palethorpe 2 participants 2 messages Sep 30, 2016 – Oct 4, 2016

lore
Share & tools
lore
#0 lore raw

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.

---
 testcases/kernel/device-drivers/rtc/rtc01.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
testcases/kernel/device-drivers/rtc/rtc01.c +9 -4
index 7f9bc07..b3c7e1d 100644
@@ -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