[LTP] [PATCH] input_common.h: Add retry loop for event device
Cyril Hrubis
chrubis@suse.cz
Fri Feb 28 12:05:10 CET 2025
Hi!
> + for (int i = 100 ; i > 0 ; i--) {
> + if (!access(path, F_OK)) {
> + tst_res(TINFO, "Found event device: %s", path);
> + break;
> + }
> + usleep(10000);
We do have a TST_RETRY_FUNC() in include/tst_common.h that is slightly
smarter than this loop and also properly scales the timeout on slow
devices automaticaly. So this should be:
if (!TST_RETRY_FUNC(access(path, F_OK), TST_RETVAL_NULL)) {
tst_res(TINFO, "Found event device: %s", path);
break;
}
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list