drm/amd/display: fix unused function warnings
Subsystems (3)
PATCH 1/1 drm/amd/display: fix unused function warnings
From: Arnd Bergmann <[email protected]>
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.
---
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(-)
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +4 -6
@@ -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 */ -
Signature · 1 line
2.53.0
Quoted 16 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
When
CONFIG_DRM_AMD_DC_DCEis disabled, most functions insdedce110_hwseq.care 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 voiddce110_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.
Quoted 5 lines
Fixes cd2cfe4d1504 ("drm/amd/display: gate DCE ASIC code behind CONFIG_DRM_AMD_DC_DCE")Signed-off-by Arnd Bergmann <[email protected]>---
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
Quoted 33 lines
--- .../gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +4
-7@@ -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