Re: [PATCH] drm/amd/display: fix unused function warnings

From: Alex Deucher

Date: Wed Sep 16 2026 - 14:12:07 EST


On Tue, Sep 15, 2026 at 4:21 PM Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
>
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> When CONFIG_DRM_AMD_DC_DCE is disabled, most functions insde dce110_hwseq.c
> are no longer referenced, causing a lot of warnings such as
>
> drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dce110/dce110_hwseq.c:3510:13: error: 'dce110_enable_analog_link_output' defined but not used [-Werror=unused-function]
> 3510 | static void dce110_enable_analog_link_output(
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dce110/dce110_hwseq.c:3391:13: error: 'dce110_set_cursor_attribute' defined but not used [-Werror=unused-function]
> 3391 | static void dce110_set_cursor_attribute(struct pipe_ctx *pipe_ctx)
>
> Replace the #ifdef with an IS_ENABLED() check that leads to an empty function
> in this configuration, so the compiler can eliminate the unused functions
> and not complain about it.
>
> Fixes: cd2cfe4d1504 ("drm/amd/display: gate DCE ASIC code behind CONFIG_DRM_AMD_DC_DCE")
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> ---
> This still leaves an unused empty function, not sure how much harder
> we should try. Maybe the file should just be built conditionally?

I think so? @Wentland, Harry What do you think?

Alex

> ---
> .../gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c
> index 817f2bf736f4..a334e10eb1cd 100644
> --- a/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c
> +++ b/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c
> @@ -3618,7 +3618,6 @@ void dce110_disable_link_output(struct dc_link *link,
> dc->link_srv->dp_trace_source_sequence(link, DPCD_SOURCE_SEQ_AFTER_DISABLE_LINK_PHY);
> }
>
> -#if defined(CONFIG_DRM_AMD_DC_DCE)
> static const struct hw_sequencer_funcs dce110_funcs = {
> .program_gamut_remap = program_gamut_remap,
> .program_output_csc = program_output_csc,
> @@ -3685,9 +3684,8 @@ static const struct hwseq_private_funcs dce110_private_funcs = {
>
> void dce110_hw_sequencer_construct(struct dc *dc)
> {
> - dc->hwss = dce110_funcs;
> - dc->hwseq->funcs = dce110_private_funcs;
> + if (IS_ENABLED(CONFIG_DRM_AMD_DC_DCE)) {
> + dc->hwss = dce110_funcs;
> + dc->hwseq->funcs = dce110_private_funcs;
> + }
> }
> -
> -#endif /* CONFIG_DRM_AMD_DC_DCE */
> -
> --
> 2.53.0
>