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

Arnd Bergmann posted 1 patch 1 week, 2 days ago
.../gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c  | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
[PATCH] drm/amd/display: fix unused function warnings
Posted by Arnd Bergmann 1 week, 2 days ago
From: Arnd Bergmann <arnd@arndb.de>

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@arndb.de>
---
This still leaves an unused empty function, not sure how much harder
we should try. Maybe the file should just be built conditionally?
---
 .../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
Re: [PATCH] drm/amd/display: fix unused function warnings
Posted by Alex Deucher 1 week, 1 day ago
On Tue, Sep 15, 2026 at 4:21 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> 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@arndb.de>
> ---
> 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
>