[igt-dev] [PATCH i-g-t 2/2] tools/intel_pm_rpm: Only init debufs_fd if needed.

Gupta, Anshuman anshuman.gupta at intel.com
Tue Nov 1 06:45:37 UTC 2022



> -----Original Message-----
> From: Vivi, Rodrigo <rodrigo.vivi at intel.com>
> Sent: Tuesday, November 1, 2022 1:29 AM
> To: igt-dev at lists.freedesktop.org
> Cc: Vivi, Rodrigo <rodrigo.vivi at intel.com>; Gupta, Anshuman
> <anshuman.gupta at intel.com>
> Subject: [PATCH i-g-t 2/2] tools/intel_pm_rpm: Only init debufs_fd if
> needed.
> 
> So we can run a --setup-d3cold without depending on the presence of a
> debugfs.
> 
> Cc: Anshuman Gupta <anshuman.gupta at intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
LGTM
Reviewed-by: Anshuman Gupta <anshuman.gupta at intel.com>
> ---
>  tools/intel_pm_rpm.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/intel_pm_rpm.c b/tools/intel_pm_rpm.c index
> 05d7f6fb..17cd2bc1 100644
> --- a/tools/intel_pm_rpm.c
> +++ b/tools/intel_pm_rpm.c
> @@ -197,10 +197,9 @@ int main(int argc, char *argv[])
>  		goto exit;
>  	}
> 
> -	data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
> -
>  	data.res = drmModeGetResources(data.drm_fd);
>  	if (data.res) {
> +		data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
>  		kmstest_set_vt_graphics_mode();
>  		igt_display_require(&data.display, data.drm_fd);
> 
> @@ -240,7 +239,8 @@ exit:
>  	if (data.res)
>  		igt_display_fini(&data.display);
> 
> -	close(data.debugfs_fd);
> +	if (data.debugfs_fd)
> +		close(data.debugfs_fd);
>  	close(data.drm_fd);
>  	igt_devices_free();
> 
> --
> 2.37.3



More information about the igt-dev mailing list