public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t] i915/hangman: Read a dummy byte to check sysfs existence
Date: Fri, 11 Jan 2019 11:37:25 +0000	[thread overview]
Message-ID: <31f82579-fd8d-0335-0bfb-4f8d0b1c5ef3@linux.intel.com> (raw)
In-Reply-To: <20190111103510.20564-1-chris@chris-wilson.co.uk>


On 11/01/2019 10:35, Chris Wilson wrote:
> sysfs doesn't give the driver an open() callback, so we can only report
> the unavailability of HW on the first read; so check read() after checking
> open().
> 
> Fixes: 93f0ad4b835e ("i915/hangman: Skip if disabled by the kernel")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>   tests/i915/hangman.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/i915/hangman.c b/tests/i915/hangman.c
> index ffbd0b057..5f63bfc4b 100644
> --- a/tests/i915/hangman.c
> +++ b/tests/i915/hangman.c
> @@ -45,14 +45,20 @@ static int sysfs = -1;
>   
>   static bool has_error_state(int dir)
>   {
> +	bool result;
>   	int fd;
>   
>   	fd = openat(dir, "error", O_RDONLY);
>   	if (fd < 0)
>   		return false;
>   
> +	if (read(fd, &result, sizeof(result)) < 0)
> +		result = false;
> +	else
> +		result = true;
> +
>   	close(fd);
> -	return true;
> +	return result;
>   }
>   
>   static void assert_entry(const char *s, bool expect)
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-01-11 11:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-11 10:35 [igt-dev] [PATCH i-g-t] i915/hangman: Read a dummy byte to check sysfs existence Chris Wilson
2019-01-11 11:08 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-01-11 11:37 ` Tvrtko Ursulin [this message]
2019-01-11 16:31 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=31f82579-fd8d-0335-0bfb-4f8d0b1c5ef3@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /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