From: Wayne Lin <Wayne.Lin@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: "Jeff Johnson" <jeff.johnson@oss.qualcomm.com>,
"Harry Wentland" <harry.wentland@amd.com>,
"Leo Li" <sunpeng.li@amd.com>,
"Rodrigo Siqueira" <siqueira@igalia.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Fangzhi Zuo" <jerry.zuo@amd.com>, "Jun Lei" <jun.lei@amd.com>,
"Tony Cheng" <Tony.Cheng@amd.com>,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/amd/display: use include guards instead of #pragma once in Core 2 headers
Date: Sun, 15 Nov 2026 15:38:44 +0800 [thread overview]
Message-ID: <20261115073844.1477890-1-Wayne.Lin@amd.com> (raw)
In-Reply-To: <20261105-amdgpu-local-fix-v1-1-4af7abf820d0@oss.qualcomm.com>
Reviewed-by: Wayne Lin <Wayne.Lin@amd.com>
On Thu, 05 Nov 2026 11:23:04 -0800, Jeff Johnson wrote:
> Commit 9d1a737c3c82 ("drm/amd/display: Keep public DC lifecycle APIs
> stable beside Core 2") added four headers that use #pragma once, the
> only headers in drivers/gpu/drm/amd/display/ to do so; every other
> header in the subsystem uses #ifndef include guards.
>
> dc_core_interface.h is included more than once within a single
> translation unit (via dc.h and again via api_shim.h / dc_core2.h). In
> the amdgpu build all display include paths are spelled with a
> "-I.../amdgpu/../display/..." prefix, so the header is reached through
> two paths that differ only by a ".." component.
>
> gcc canonicalizes the ".." and deduplicates the header by its real
> path, so the normal CC build is fine. sparse (make C=1/C=2) does not
> canonicalize ".." for #pragma once, treats the two spellings as
> different files and processes the header twice, which breaks the build:
>
> dc_core_interface.h:14: error: redefinition of \
> unsigned int enum dc2_selection
>
> This fails the CHECK pass for api_shim.c, dc_core2.c and core/dc.c.
>
> Convert the four new headers to standard #ifndef include guards, which
> sparse honors regardless of how the path is spelled, matching the rest
> of the subsystem. No functional change for gcc builds.
>
> Fixes: 9d1a737c3c82 ("drm/amd/display: Keep public DC lifecycle APIs stable beside Core 2")
> Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
> ---
> Issue debugged and patch generated using Claude Code Opus 4.8.
> I have reviewed the patch and have verified a clean W=1 C=1 build.
> ---
> drivers/gpu/drm/amd/display/dc/core2/dc_core2.h | 5 ++++-
> drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.h | 5 ++++-
> drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.h | 5 ++++-
> drivers/gpu/drm/amd/display/dc/inc/dc_core_interface.h | 5 ++++-
> 4 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/core2/dc_core2.h b/drivers/gpu/drm/amd/display/dc/core2/dc_core2.h
> index a761e85a9973..867fe9023fc7 100644
> --- a/drivers/gpu/drm/amd/display/dc/core2/dc_core2.h
> +++ b/drivers/gpu/drm/amd/display/dc/core2/dc_core2.h
> @@ -3,7 +3,8 @@
> * Copyright 2026 Advanced Micro Devices, Inc.
> */
>
> -#pragma once
> +#ifndef DC_CORE2_H_
> +#define DC_CORE2_H_
>
> #include "inc/dc_core_interface.h"
>
> @@ -17,3 +18,5 @@ struct dc_core2 {
> const struct dc2_funcs *core2_funcs(void);
> void core2_construct(struct dc *dc);
> void core2_destruct(struct dc *dc);
> +
> +#endif /* DC_CORE2_H_ */
> diff --git a/drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.h b/drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.h
> index a4fa0365cd4f..b081801f664e 100644
> --- a/drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.h
> +++ b/drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.h
> @@ -3,8 +3,11 @@
> * Copyright 2026 Advanced Micro Devices, Inc.
> */
>
> -#pragma once
> +#ifndef DC_CORE2_INIT_H_
> +#define DC_CORE2_INIT_H_
>
> struct dc;
>
> void core2_hardware_init(struct dc *dc);
> +
> +#endif /* DC_CORE2_INIT_H_ */
> diff --git a/drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.h b/drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.h
> index fee03a5dd596..00cf48b14f53 100644
> --- a/drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.h
> +++ b/drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.h
> @@ -3,7 +3,8 @@
> * Copyright 2026 Advanced Micro Devices, Inc.
> */
>
> -#pragma once
> +#ifndef DC_API_DISPATCH_API_SHIM_H_
> +#define DC_API_DISPATCH_API_SHIM_H_
>
> #include "dc.h"
> #include "inc/dc_core_interface.h"
> @@ -17,3 +18,5 @@ struct dc2 {
> #define TO_DC2(ptr) ((struct dc2 *)(ptr))
>
> void api_shim_construct(struct dc *dc, const struct dc_init_data *init_params);
> +
> +#endif /* DC_API_DISPATCH_API_SHIM_H_ */
> diff --git a/drivers/gpu/drm/amd/display/dc/inc/dc_core_interface.h b/drivers/gpu/drm/amd/display/dc/inc/dc_core_interface.h
> index 35a6218c1285..264bd8bf3bc0 100644
> --- a/drivers/gpu/drm/amd/display/dc/inc/dc_core_interface.h
> +++ b/drivers/gpu/drm/amd/display/dc/inc/dc_core_interface.h
> @@ -3,7 +3,8 @@
> * Copyright 2026 Advanced Micro Devices, Inc.
> */
>
> -#pragma once
> +#ifndef DC_CORE_INTERFACE_H_
> +#define DC_CORE_INTERFACE_H_
>
> struct dc;
>
> @@ -29,3 +30,5 @@ struct dc2_funcs {
> void legacy_hardware_init(struct dc *dc);
> void legacy_hardware_release(struct dc *dc);
> const struct dc2_funcs *dc2_legacy_funcs(void);
> +
> +#endif /* DC_CORE_INTERFACE_H_ */
>
> ---
> base-commit: d7e11a5269dc892cbee8a01dccbdb20bb4f653da
> change-id: 20261105-amdgpu-local-fix-908074837d48
>
>
prev parent reply other threads:[~2026-11-15 7:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 19:23 [PATCH] drm/amd/display: use include guards instead of #pragma once in Core 2 headers Jeff Johnson
2026-11-15 7:38 ` Wayne Lin [this message]
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=20261115073844.1477890-1-Wayne.Lin@amd.com \
--to=wayne.lin@amd.com \
--cc=Tony.Cheng@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=jeff.johnson@oss.qualcomm.com \
--cc=jerry.zuo@amd.com \
--cc=jun.lei@amd.com \
--cc=simona@ffwll.ch \
--cc=siqueira@igalia.com \
--cc=sunpeng.li@amd.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.