[PATCH i-g-t v7 10/16] lib/xe_eudebug: Introduce eu debug testing framework
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Thu Sep 19 05:47:50 UTC 2024
On Wed, Sep 18, 2024 at 01:30:11PM +0200, Christoph Manszewski wrote:
<cut>
> +static int enable_getset(int fd, bool *old, bool *new)
> +{
> + static const char * const fname = "enable_eudebug";
> + int ret = 0;
> + int sysfs, device_fd;
> + bool val_before;
> + struct stat st;
> +
> + igt_assert(new || old);
Shouldn't this be igt_assert(new && old)?
> + igt_assert_eq(fstat(fd, &st), 0);
> +
> + sysfs = igt_sysfs_open(fd);
> + if (sysfs < 0)
> + return -1;
> +
> + device_fd = openat(sysfs, "device", O_DIRECTORY | O_RDONLY);
> + close(sysfs);
> + if (device_fd < 0)
> + return -1;
> +
> + if (!__igt_sysfs_get_boolean(device_fd, fname, &val_before)) {
> + ret = -1;
> + goto out;
> + }
> +
> + igt_debug("enable_eudebug before: %d\n", val_before);
> +
> + if (old)
> + *old = val_before;
> +
> + if (new) {
> + if (__igt_sysfs_set_boolean(device_fd, fname, *new))
> + igt_assert_eq(igt_sysfs_get_boolean(device_fd, fname), *new);
> + else
> + ret = -1;
> + }
> +
> +out:
> + close(device_fd);
> +
> + return ret;
> +}
> +
I've compared to previous series and IMO this acceptable, keep a-b.
--
Zbigniew
More information about the igt-dev
mailing list