[igt-dev] [V3 i-g-t 12/23] tests/amdgpu: Use drm_close_driver() to close the drm fd

Christian König christian.koenig at amd.com
Thu Jun 22 07:22:52 UTC 2023


Am 22.06.23 um 08:54 schrieb Bhanuprakash Modem:
> To close the drm file descriptor, use igt helper drm_close_driver()
> instead of using close().
>
> Cc: Vitaly Prosyak <vitaly.prosyak at amd.com>
> Cc: Christian König <christian.koenig at amd.com>
> Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>

Reviewed-by: Christian König <christian.koenig at amd.com>

> ---
>   tests/amdgpu/amd_basic.c       | 2 +-
>   tests/amdgpu/amd_cs_nop.c      | 2 +-
>   tests/amdgpu/amd_deadlock.c    | 2 +-
>   tests/amdgpu/amd_info.c        | 2 +-
>   tests/amdgpu/amd_module_load.c | 2 +-
>   tests/amdgpu/amd_prime.c       | 6 +++---
>   6 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/tests/amdgpu/amd_basic.c b/tests/amdgpu/amd_basic.c
> index 38525a85e..f7d7f036f 100644
> --- a/tests/amdgpu/amd_basic.c
> +++ b/tests/amdgpu/amd_basic.c
> @@ -696,6 +696,6 @@ igt_main
>   
>   	igt_fixture {
>   		amdgpu_device_deinitialize(device);
> -		close(fd);
> +		drm_close_driver(fd);
>   	}
>   }
> diff --git a/tests/amdgpu/amd_cs_nop.c b/tests/amdgpu/amd_cs_nop.c
> index ea3f6aae8..323c1b16a 100644
> --- a/tests/amdgpu/amd_cs_nop.c
> +++ b/tests/amdgpu/amd_cs_nop.c
> @@ -239,6 +239,6 @@ igt_main
>   	igt_fixture {
>   		amdgpu_cs_ctx_free(context);
>   		amdgpu_device_deinitialize(device);
> -		close(fd);
> +		drm_close_driver(fd);
>   	}
>   }
> diff --git a/tests/amdgpu/amd_deadlock.c b/tests/amdgpu/amd_deadlock.c
> index df650c921..d805b8d18 100644
> --- a/tests/amdgpu/amd_deadlock.c
> +++ b/tests/amdgpu/amd_deadlock.c
> @@ -118,6 +118,6 @@ igt_main
>   
>   	igt_fixture {
>   		amdgpu_device_deinitialize(device);
> -		close(fd);
> +		drm_close_driver(fd);
>   	}
>   }
> diff --git a/tests/amdgpu/amd_info.c b/tests/amdgpu/amd_info.c
> index d6aea827b..c1137ab4d 100644
> --- a/tests/amdgpu/amd_info.c
> +++ b/tests/amdgpu/amd_info.c
> @@ -154,6 +154,6 @@ igt_main
>   
>   	igt_fixture {
>   		amdgpu_device_deinitialize(dev);
> -		close(fd);
> +		drm_close_driver(fd);
>   	}
>   }
> diff --git a/tests/amdgpu/amd_module_load.c b/tests/amdgpu/amd_module_load.c
> index 77df96d50..cbc9106f6 100644
> --- a/tests/amdgpu/amd_module_load.c
> +++ b/tests/amdgpu/amd_module_load.c
> @@ -54,7 +54,7 @@ static void sanity_check(void)
>   		err = -errno;
>   
>   	igt_set_timeout(0, NULL);
> -	close(fd);
> +	drm_close_driver(fd);
>   
>   	igt_assert_eq(err, 0);
>   }
> diff --git a/tests/amdgpu/amd_prime.c b/tests/amdgpu/amd_prime.c
> index 62924f15b..6916c3173 100644
> --- a/tests/amdgpu/amd_prime.c
> +++ b/tests/amdgpu/amd_prime.c
> @@ -166,7 +166,7 @@ static void amd_plug(amdgpu_device_handle device, struct cork *c)
>   static void unplug(struct cork *c)
>   {
>   	vgem_fence_signal(c->device, c->fence);
> -	close(c->device);
> +	drm_close_driver(c->device);
>   }
>   
>   static void i915_to_amd(int i915, int amd, amdgpu_device_handle device)
> @@ -461,7 +461,7 @@ igt_main
>   
>   	igt_fixture {
>   		amdgpu_device_deinitialize(device);
> -		close(amd);
> -		close(i915);
> +		drm_close_driver(amd);
> +		drm_close_driver(i915);
>   	}
>   }



More information about the igt-dev mailing list