Skip to contentSkip to conversation

Address a few compilation warnings

PATCH In review Magali Lemes 3 participants 7 messages Feb 24, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Address a few compilation warnings

This patchset addresses a few warnings reported by the Kernel Test Robot and sparse.

Magali Lemes (4):
drm/amd/display: Adjust functions documentation drm/amd/display: Add conditional around function drm/amd/display: Use NULL instead of 0 drm/amd/display: Turn functions into static

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c   | 4 +++-
 .../gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c  | 2 +-
 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c  | 4 ++--
 drivers/gpu/drm/amd/display/dc/core/dc.c                    | 6 +++---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c           | 2 +-
 drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 4 ++--
 drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c     | 4 +---
 .../gpu/drm/amd/display/dc/irq/dcn315/irq_service_dcn315.c  | 2 +-
 8 files changed, 14 insertions(+), 14 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/4 drm/amd/display: Adjust functions documentation

Part of the documentation of the 'dc_process_dmub_aux_transfer_async' function was misplaced, being put together with the ‘dc_enable_dmub_notifications’ documentation. This caused the following warning:

drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:3757: warning:
expecting prototype for dc_process_dmub_aux_transfer_async(). Prototype was for dc_enable_dmub_notifications() instead

This commit fixes the warning by placing the function documentations in their right place.

---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +3 -3
index b1ce3c0cf477..61e3bb99375f 100644
@@ -3737,8 +3737,8 @@ bool dc_is_dmub_outbox_supported(struct dc *dc)
 	return dc->debug.enable_dmub_aux_for_legacy_ddc;
 }
 
-/**
- * dc_process_dmub_aux_transfer_async - Submits aux command to dmub via inbox message
+/*
+ *****************************************************************************
  *  Function: dc_enable_dmub_notifications
  *
  *  @brief
@@ -3780,7 +3780,7 @@ void dc_enable_dmub_outbox(struct dc *dc)
 }
 
 /**
- *****************************************************************************
+ * dc_process_dmub_aux_transfer_async - Submits aux command to dmub via inbox message
  *                                      Sets port index appropriately for legacy DDC
  * @dc: dc structure
  * @link_index: link index
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/4 drm/amd/display: Add conditional around function

In reply to Magali Lemes

When CONFIG_DRM_AMD_DC_DCN is not set, the function 'dm_helpers_enable_periodic_detection' doesn't have its prototype defined, causing the following warning:

drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_helpers.c:805:6:
warning: no previous prototype for function 'dm_helpers_enable_periodic_detection' [-Wmissing-prototypes]
void dm_helpers_enable_periodic_detection(struct dc_context *ctx, bool enable)

        ^

drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_helpers.c:805:1:
note: declare 'static' if the function is not intended to be used outside of this translation unit
void dm_helpers_enable_periodic_detection(struct dc_context *ctx, bool enable) ^
static
1 warning generated.

This commit silences this warning by adding a conditional directive around the mentioned function, and also corrects a small spelling error.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +3 -1
index 010498ff5911..f5f39984702f 100644
@@ -977,7 +977,9 @@ void dm_set_phyd32clk(struct dc_context *ctx, int freq_khz)
        // TODO
 }
 
+#if defined(CONFIG_DRM_AMD_DC_DCN)
 void dm_helpers_enable_periodic_detection(struct dc_context *ctx, bool enable)
 {
-	/* TODO: add peridic detection implementation */
+	/* TODO: add periodic detection implementation */
 }
+#endif
Signature · 1 line
2.25.1
#3 lore raw

PATCH 3/4 drm/amd/display: Use NULL instead of 0

In reply to Magali Lemes

Silence the following sparse warnings:

../drivers/gpu/drm/amd/amdgpu/../display/dc/dce112/dce112_resource.c:865:16:
sparse: warning: Using plain integer as NULL pointer

../drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:1588:84:
sparse: warning: Using plain integer as NULL pointer

../drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:2725:84:
sparse: warning: Using plain integer as NULL pointer

../drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_resource.c:1919:16:
sparse: warning: Using plain integer as NULL pointer

---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c           | 2 +-
 drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 4 ++--
 drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c     | 4 +---
 3 files changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +1 -1
index 4367a6e0c224..cc8e60ec35c6 100644
@@ -1924,7 +1924,7 @@ static struct audio *find_first_free_audio(
 			return pool->audios[i];
 		}
 	}
-	return 0;
+	return NULL;
 }
 
 /*
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +2 -2
index ace04e2ed34e..8378b80e8517 100644
@@ -1585,7 +1585,7 @@ static enum dc_status apply_single_controller_ctx_to_hw(
 			hws->funcs.enable_stream_timing(pipe_ctx, context, dc);
 	}
 
-	pipe_ctx->plane_res.scl_data.lb_params.alpha_en = pipe_ctx->bottom_pipe != 0;
+	pipe_ctx->plane_res.scl_data.lb_params.alpha_en = pipe_ctx->bottom_pipe != NULL;
 
 	pipe_ctx->stream->link->psr_settings.psr_feature_enabled = false;
 
@@ -2722,7 +2722,7 @@ static void dce110_program_front_end_for_pipe(
 
 	pipe_ctx->plane_res.xfm->funcs->transform_set_gamut_remap(pipe_ctx->plane_res.xfm, &adjust);
 
-	pipe_ctx->plane_res.scl_data.lb_params.alpha_en = pipe_ctx->bottom_pipe != 0;
+	pipe_ctx->plane_res.scl_data.lb_params.alpha_en = pipe_ctx->bottom_pipe != NULL;
 
 	program_scaler(dc, pipe_ctx);
 
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +1 -3
index ee55cda854bf..8104c0c67f78 100644
@@ -858,11 +858,9 @@ static struct clock_source *find_matching_pll(
 		return pool->clock_sources[DCE112_CLK_SRC_PLL4];
 	case TRANSMITTER_UNIPHY_F:
 		return pool->clock_sources[DCE112_CLK_SRC_PLL5];
-	default:
-		return NULL;
 	}
 
-	return 0;
+	return NULL;
 }
 
 static enum dc_status build_mapped_resource(
Signature · 1 line
2.25.1
#4 lore raw

PATCH 4/4 drm/amd/display: Turn functions into static

In reply to Magali Lemes

Silence [-Wmissing-prototypes] sparse warnings from the display folder such as:

../drivers/gpu/drm/amd/amdgpu/../display/dc/clk_mgr/dcn315/dcn315_smu.c:126:5: warning: no previous prototype for ‘dcn315_smu_send_msg_with_param’ [-Wmissing-prototypes]
126 | int dcn315_smu_send_msg_with_param(

      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 .../gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c    | 2 +-
 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c    | 4 ++--
 .../gpu/drm/amd/display/dc/irq/dcn315/irq_service_dcn315.c    | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c +1 -1
index d66633bef2b3..357f89b4a8e0 100644
@@ -430,7 +430,7 @@ static unsigned int find_clk_for_voltage(
 	return 0;
 }
 
-void dcn315_clk_mgr_helper_populate_bw_params(
+static void dcn315_clk_mgr_helper_populate_bw_params(
 		struct clk_mgr_internal *clk_mgr,
 		struct integrated_info *bios_info,
 		const DpmClocks_315_t *clock_table)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c +2 -2
index a60543258a5b..831fd1494d60 100644
@@ -123,7 +123,7 @@ static uint32_t dcn315_smu_wait_for_response(struct clk_mgr_internal *clk_mgr, u
 	return res_val;
 }
 
-int dcn315_smu_send_msg_with_param(
+static int dcn315_smu_send_msg_with_param(
 		struct clk_mgr_internal *clk_mgr,
 		unsigned int msg_id, unsigned int param)
 {
@@ -181,7 +181,7 @@ int dcn315_smu_set_dispclk(struct clk_mgr_internal *clk_mgr, int requested_dispc
 
 	return actual_dispclk_set_mhz * 1000;
 }
-int dcn315_smu_set_voltage_via_phyclk(struct clk_mgr_internal *clk_mgr, int requested_phyclk_khz)
+static int dcn315_smu_set_voltage_via_phyclk(struct clk_mgr_internal *clk_mgr, int requested_phyclk_khz)
 {
 	int actual_phypclk_set_mhz = -1;
 
drivers/gpu/drm/amd/display/dc/irq/dcn315/irq_service_dcn315.c +1 -1
index 33367773699b..e722171f0d2d 100644
@@ -42,7 +42,7 @@
 #define DCN_BASE__INST0_SEG4                       0x02403C00
 #define DCN_BASE__INST0_SEG5                       0
 
-enum dc_irq_source to_dal_irq_source_dcn315(
+static enum dc_irq_source to_dal_irq_source_dcn315(
 		struct irq_service *irq_service,
 		uint32_t src_id,
 		uint32_t ext_id)
Signature · 1 line
2.25.1
maintainer Reviewed-by on the v1 series
#5 lore raw
In reply to Magali Lemes

Series is

Harry

Quoted 19 lines · Magali Lemes

This patchset addresses a few warnings reported by the Kernel Test Robot and sparse.

Magali Lemes (4):
drm/amd/display: Adjust functions documentation drm/amd/display: Add conditional around function drm/amd/display: Use NULL instead of 0 drm/amd/display: Turn functions into static

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c   | 4 +++-
 .../gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c  | 2 +-
 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c  | 4 ++--
 drivers/gpu/drm/amd/display/dc/core/dc.c                    | 6 +++---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c           | 2 +-
 drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 4 ++--
 drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c     | 4 +---
 .../gpu/drm/amd/display/dc/irq/dcn315/irq_service_dcn315.c  | 2 +-
 8 files changed, 14 insertions(+), 14 deletions(-)
#6 lore raw

Applied with some minor modifications to patches 3 and 4 to avoid adding new warnings.

Alex

Quoted 27 lines · Harry Wentland

Series is

Harry

Quoted 19 lines · Magali Lemes

This patchset addresses a few warnings reported by the Kernel Test Robot and sparse.

Magali Lemes (4):
drm/amd/display: Adjust functions documentation drm/amd/display: Add conditional around function drm/amd/display: Use NULL instead of 0 drm/amd/display: Turn functions into static

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c   | 4 +++-
 .../gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c  | 2 +-
 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c  | 4 ++--
 drivers/gpu/drm/amd/display/dc/core/dc.c                    | 6 +++---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c           | 2 +-
 drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 4 ++--
 drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c     | 4 +---
 .../gpu/drm/amd/display/dc/irq/dcn315/irq_service_dcn315.c  | 2 +-
 8 files changed, 14 insertions(+), 14 deletions(-)