Linux Test Project
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Edward Liaw <edliaw@google.com>
Cc: kernel-team@android.com, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] input_common.h: Add retry loop for event device
Date: Fri, 28 Feb 2025 12:05:10 +0100	[thread overview]
Message-ID: <Z8GYZij7KEozKe8j@yuki.lan> (raw)
In-Reply-To: <20250227180512.355110-1-edliaw@google.com>

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      reply	other threads:[~2025-02-28 11:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-27 18:05 [LTP] [PATCH] input_common.h: Add retry loop for event device Edward Liaw via ltp
2025-02-28 11:05 ` Cyril Hrubis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z8GYZij7KEozKe8j@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=edliaw@google.com \
    --cc=kernel-team@android.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox