[LTP] [PATCH v2 2/2] rtc02: skip (TCONF) on read-only RTCs that reject RTC_SET_TIME

Andrea Cervesato andrea.cervesato@suse.com
Tue Jul 21 15:14:39 CEST 2026


Hi Kuba,

> +	/*
> +	 * Skip on RTCs that do not allow setting the time, e.g. Qualcomm PMIC
> +	 * RTCs without allow-set-time or an nvmem offset, where RTC_SET_TIME
> +	 * returns -ENODEV. Probe with the current time so a writable RTC is
> +	 * left unchanged, and skip here (before tst_rtc_clock_save()) so the
> +	 * cleanup restore does not fail on such devices.
> +	 *
> +	 * Only ENODEV is treated as "not supported" here. Wider errnos such as
> +	 * EINVAL are used broadly by the kernel and could mask a genuine
> +	 * failure, so let anything else fall through to TBROK.
> +	 */

Please don't add more info than what we already need. The git commit
already explains why we have this change and the change talks by itself:
we need to verify if RTC is enabled or not.

> +	if (tst_rtc_gettime(rtc_dev, &probe_tm))
> +		tst_brk(TBROK | TERRNO, "ioctl() RTC_RD_TIME");

Space here.

> +	if (tst_rtc_settime(rtc_dev, &probe_tm)) {
> +		if (errno == ENODEV)
> +			tst_brk(TCONF | TERRNO,
> +				"RTC does not support setting the time");

Move it in one line.

> +		tst_brk(TBROK | TERRNO, "ioctl() RTC_SET_TIME");
> +	}
> +
>  	tst_rtc_clock_save(rtc_dev);
>  }

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com


More information about the ltp mailing list