Skip to contentSkip to conversation

drm/amdgpu/display: Protect some functions with CONFIG_DRM_AMD_DC_DCN

PATCH In review Alex Deucher 2 participants 2 messages Jun 2, 2022

Subsystems (3)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/1 drm/amdgpu/display: Protect some functions with CONFIG_DRM_AMD_DC_DCN

Protect remove_hpo_dp_link_enc_from_ctx() and release_hpo_dp_link_enc() with CONFIG_DRM_AMD_DC_DCN as the functions are only called from code that is protected by CONFIG_DRM_AMD_DC_DCN. Fixes build fail with -Werror=unused-function.

Fixes 9b0e0d433f74 ("drm/amd/display: Add dependant changes for DCN32/321")
Cc Aurabindo Pillai <[email protected]>
---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +4 -0
index b087452e4590..a098fd0cb240 100644
@@ -1801,6 +1801,7 @@ static inline void retain_hpo_dp_link_enc(
 	res_ctx->hpo_dp_link_enc_ref_cnts[enc_index]++;
 }
 
+#if defined(CONFIG_DRM_AMD_DC_DCN)
 static inline void release_hpo_dp_link_enc(
 		struct resource_context *res_ctx,
 		int enc_index)
@@ -1808,6 +1809,7 @@ static inline void release_hpo_dp_link_enc(
 	ASSERT(res_ctx->hpo_dp_link_enc_ref_cnts[enc_index] > 0);
 	res_ctx->hpo_dp_link_enc_ref_cnts[enc_index]--;
 }
+#endif
 
 static bool add_hpo_dp_link_enc_to_ctx(struct resource_context *res_ctx,
 		const struct resource_pool *pool,
@@ -1832,6 +1834,7 @@ static bool add_hpo_dp_link_enc_to_ctx(struct resource_context *res_ctx,
 	return pipe_ctx->link_res.hpo_dp_link_enc != NULL;
 }
 
+#if defined(CONFIG_DRM_AMD_DC_DCN)
 static void remove_hpo_dp_link_enc_from_ctx(struct resource_context *res_ctx,
 		struct pipe_ctx *pipe_ctx,
 		struct dc_stream_state *stream)
@@ -1845,6 +1848,7 @@ static void remove_hpo_dp_link_enc_from_ctx(struct resource_context *res_ctx,
 		pipe_ctx->link_res.hpo_dp_link_enc = NULL;
 	}
 }
+#endif
 
 /* TODO: release audio object */
 void update_audio_usage(
Signature · 1 line
2.35.3
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Alex Deucher

Protect remove_hpo_dp_link_enc_from_ctx() and release_hpo_dp_link_enc() with CONFIG_DRM_AMD_DC_DCN as the functions are only called from code that is protected by CONFIG_DRM_AMD_DC_DCN. Fixes build fail with -Werror=unused-function.

Fixes 9b0e0d433f74 ("drm/amd/display: Add dependant changes for DCN32/321")
Cc Aurabindo Pillai <[email protected]>

Harry

Quoted 40 lines
---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +4 -0
index b087452e4590..a098fd0cb240 100644
@@ -1801,6 +1801,7 @@ static inline void retain_hpo_dp_link_enc(
 	res_ctx->hpo_dp_link_enc_ref_cnts[enc_index]++;
 }
 
+#if defined(CONFIG_DRM_AMD_DC_DCN)
 static inline void release_hpo_dp_link_enc(
 		struct resource_context *res_ctx,
 		int enc_index)
@@ -1808,6 +1809,7 @@ static inline void release_hpo_dp_link_enc(
 	ASSERT(res_ctx->hpo_dp_link_enc_ref_cnts[enc_index] > 0);
 	res_ctx->hpo_dp_link_enc_ref_cnts[enc_index]--;
 }
+#endif
 
 static bool add_hpo_dp_link_enc_to_ctx(struct resource_context *res_ctx,
 		const struct resource_pool *pool,
@@ -1832,6 +1834,7 @@ static bool add_hpo_dp_link_enc_to_ctx(struct resource_context *res_ctx,
 	return pipe_ctx->link_res.hpo_dp_link_enc != NULL;
 }
 
+#if defined(CONFIG_DRM_AMD_DC_DCN)
 static void remove_hpo_dp_link_enc_from_ctx(struct resource_context *res_ctx,
 		struct pipe_ctx *pipe_ctx,
 		struct dc_stream_state *stream)
@@ -1845,6 +1848,7 @@ static void remove_hpo_dp_link_enc_from_ctx(struct resource_context *res_ctx,
 		pipe_ctx->link_res.hpo_dp_link_enc = NULL;
 	}
 }
+#endif
 
 /* TODO: release audio object */
 void update_audio_usage(