[PATCH i-g-t v1 6/7] tests/core_hotunplug: Fix device close

Andrzej Hajda andrzej.hajda at intel.com
Wed Jun 12 07:17:04 UTC 2024



On 07.06.2024 17:36, Kamil Konieczny wrote:
> Use __drm_device_close for closing a drm device, as for Xe driver
> it needs to call additional function.
>
> Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> ---
>   tests/core_hotunplug.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c
> index ddf11bb00..3b0135fc8 100644
> --- a/tests/core_hotunplug.c
> +++ b/tests/core_hotunplug.c
> @@ -146,7 +146,11 @@ static int close_device(int fd_drm, const char *when, const char *which)
>   		return fd_drm;
>   
>   	local_debug("%sclosing %sdevice instance\n", when, which);
> -	return local_close(fd_drm, "Device close failed");
> +	errno = 0;
> +	if (igt_warn_on_f(__drm_close_driver(fd_drm), "Device close failed\n"))
> +		return -errno;	/* (never -1) */
> +
> +	return -1;	/* success */

We have:
local_close
close_device
__drm_close_driver
drm_close_driver

Why do not put the code above into some of these and call here just:
         return proper_close_variant()

Up to you, could be separate patch.

Reviewed-by: Andrzej Hajda <andrzej.hajda at intel.com>

Regards
Andrzej

>   }
>   
>   static int close_sysfs(int fd_sysfs_dev)



More information about the igt-dev mailing list