Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1486196 > unrolled thread

[PATCH] drm/amd/powerplay/smumgr: mark symbols static where possible

Started byBaoyou Xie <baoyou.xie@linaro.org>
First post2016-09-19 09:30 +0200
Last post2016-09-19 10:10 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] drm/amd/powerplay/smumgr: mark symbols static where possible Baoyou Xie <baoyou.xie@linaro.org> - 2016-09-19 09:30 +0200
    Re: [PATCH] drm/amd/powerplay/smumgr: mark symbols static where possible Arnd Bergmann <arnd@arndb.de> - 2016-09-19 09:40 +0200
      Re: [PATCH] drm/amd/powerplay/smumgr: mark symbols static where possible Arnd Bergmann <arnd@arndb.de> - 2016-09-19 10:10 +0200

#1486196 — [PATCH] drm/amd/powerplay/smumgr: mark symbols static where possible

FromBaoyou Xie <baoyou.xie@linaro.org>
Date2016-09-19 09:30 +0200
Subject[PATCH] drm/amd/powerplay/smumgr: mark symbols static where possible
Message-ID<sj1bz-2rl-3@gated-at.bofh.it>
We get a few warnings when building kernel with W=1:
drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/tonga_smumgr.c:146:5: warning: no previous prototype for 'tonga_program_jump_on_start' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/fiji_smumgr.c:816:5: warning: no previous prototype for 'fiji_save_vft_table' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/polaris10_smumgr.c:743:5: warning: no previous prototype for 'polaris10_avfs_event_mgr' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/iceland_smumgr.c:167:5: warning: no previous prototype for 'iceland_program_jump_on_start' [-Wmissing-prototypes]
....

In fact, these functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
So this patch marks these functions with 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
---
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c | 22 +++++++++++-----------
 .../gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c  |  2 +-
 .../drm/amd/powerplay/smumgr/polaris10_smumgr.c    | 20 +++++++++++++-------
 .../gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c    |  2 +-
 4 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
index 8e52a2e..96fc38e 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
@@ -187,7 +187,7 @@ int fiji_copy_bytes_to_smc(struct pp_smumgr *smumgr,
 	return 0;
 }
 
-int fiji_program_jump_on_start(struct pp_smumgr *smumgr)
+static int fiji_program_jump_on_start(struct pp_smumgr *smumgr)
 {
 	static const unsigned char data[] = { 0xE0, 0x00, 0x80, 0x40 };
 
@@ -201,7 +201,7 @@ int fiji_program_jump_on_start(struct pp_smumgr *smumgr)
 *
 * @param    smumgr  the address of the powerplay hardware manager.
 */
-bool fiji_is_smc_ram_running(struct pp_smumgr *smumgr)
+static bool fiji_is_smc_ram_running(struct pp_smumgr *smumgr)
 {
 	return ((0 == SMUM_READ_VFPF_INDIRECT_FIELD(smumgr->device,
 			CGS_IND_REG__SMC,
@@ -217,7 +217,7 @@ bool fiji_is_smc_ram_running(struct pp_smumgr *smumgr)
 * @param    msg the message to send.
 * @return   The response that came from the SMC.
 */
-int fiji_send_msg_to_smc(struct pp_smumgr *smumgr, uint16_t msg)
+static int fiji_send_msg_to_smc(struct pp_smumgr *smumgr, uint16_t msg)
 {
 	if (!fiji_is_smc_ram_running(smumgr))
 		return -1;
@@ -240,7 +240,7 @@ int fiji_send_msg_to_smc(struct pp_smumgr *smumgr, uint16_t msg)
  * @param    parameter: the parameter to send
  * @return   The response that came from the SMC.
  */
-int fiji_send_msg_to_smc_with_parameter(struct pp_smumgr *smumgr,
+static int fiji_send_msg_to_smc_with_parameter(struct pp_smumgr *smumgr,
 		uint16_t msg, uint32_t parameter)
 {
 	if (!fiji_is_smc_ram_running(smumgr))
@@ -267,7 +267,7 @@ int fiji_send_msg_to_smc_with_parameter(struct pp_smumgr *smumgr,
 * @param    parameter: the parameter to send
 * @return   The response that came from the SMC.
 */
-int fiji_send_msg_to_smc_with_parameter_without_waiting(
+static int fiji_send_msg_to_smc_with_parameter_without_waiting(
 		struct pp_smumgr *smumgr, uint16_t msg, uint32_t parameter)
 {
 	if (1 != SMUM_READ_FIELD(smumgr->device, SMC_RESP_0, SMC_RESP)) {
@@ -661,7 +661,7 @@ static int fiji_start_smu_in_non_protection_mode(struct pp_smumgr *smumgr)
 	return result;
 }
 
-int fiji_setup_pwr_virus(struct pp_smumgr *smumgr)
+static int fiji_setup_pwr_virus(struct pp_smumgr *smumgr)
 {
 	int i, result = -1;
 	uint32_t reg, data;
@@ -726,7 +726,7 @@ static int fiji_start_avfs_btc(struct pp_smumgr *smumgr)
 	return result;
 }
 
-int fiji_setup_pm_fuse_for_avfs(struct pp_smumgr *smumgr)
+static int fiji_setup_pm_fuse_for_avfs(struct pp_smumgr *smumgr)
 {
 	int result = 0;
 	uint32_t table_start;
@@ -762,7 +762,7 @@ int fiji_setup_pm_fuse_for_avfs(struct pp_smumgr *smumgr)
 	return result;
 }
 
-int fiji_setup_graphics_level_structure(struct pp_smumgr *smumgr)
+static int fiji_setup_graphics_level_structure(struct pp_smumgr *smumgr)
 {
 	int32_t vr_config;
 	uint32_t table_start;
@@ -801,7 +801,7 @@ int fiji_setup_graphics_level_structure(struct pp_smumgr *smumgr)
 }
 
 /* Work in Progress */
-int fiji_restore_vft_table(struct pp_smumgr *smumgr)
+static int fiji_restore_vft_table(struct pp_smumgr *smumgr)
 {
 	struct fiji_smumgr *priv = (struct fiji_smumgr *)(smumgr->backend);
 
@@ -813,7 +813,7 @@ int fiji_restore_vft_table(struct pp_smumgr *smumgr)
 }
 
 /* Work in Progress */
-int fiji_save_vft_table(struct pp_smumgr *smumgr)
+static int fiji_save_vft_table(struct pp_smumgr *smumgr)
 {
 	struct fiji_smumgr *priv = (struct fiji_smumgr *)(smumgr->backend);
 
@@ -824,7 +824,7 @@ int fiji_save_vft_table(struct pp_smumgr *smumgr)
 		return -EINVAL;
 }
 
-int fiji_avfs_event_mgr(struct pp_smumgr *smumgr, bool smu_started)
+static int fiji_avfs_event_mgr(struct pp_smumgr *smumgr, bool smu_started)
 {
 	struct fiji_smumgr *priv = (struct fiji_smumgr *)(smumgr->backend);
 
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c
index f506583..e5a2b0c 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c
@@ -164,7 +164,7 @@ static void iceland_pp_reset_smc(struct pp_smumgr *smumgr)
 				  rst_reg, 1);
 }
 
-int iceland_program_jump_on_start(struct pp_smumgr *smumgr)
+static int iceland_program_jump_on_start(struct pp_smumgr *smumgr)
 {
 	static const unsigned char pData[] = { 0xE0, 0x00, 0x80, 0x40 };
 
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
index 704ff4c..e7f7b68 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
@@ -212,7 +212,7 @@ static int polaris10_program_jump_on_start(struct pp_smumgr *smumgr)
 *
 * @param    smumgr  the address of the powerplay hardware manager.
 */
-bool polaris10_is_smc_ram_running(struct pp_smumgr *smumgr)
+static bool polaris10_is_smc_ram_running(struct pp_smumgr *smumgr)
 {
 	return ((0 == SMUM_READ_VFPF_INDIRECT_FIELD(smumgr->device, CGS_IND_REG__SMC, SMC_SYSCON_CLOCK_CNTL_0, ck_disable))
 	&& (0x20100 <= cgs_read_ind_register(smumgr->device, CGS_IND_REG__SMC, ixSMC_PC_C)));
@@ -237,7 +237,8 @@ static bool polaris10_is_hw_avfs_present(struct pp_smumgr *smumgr)
 * @param    msg the message to send.
 * @return   The response that came from the SMC.
 */
-int polaris10_send_msg_to_smc(struct pp_smumgr *smumgr, uint16_t msg)
+static int
+polaris10_send_msg_to_smc(struct pp_smumgr *smumgr, uint16_t msg)
 {
 	int ret;
 
@@ -272,7 +273,9 @@ int polaris10_send_msg_to_smc(struct pp_smumgr *smumgr, uint16_t msg)
 * @param    msg the message to send.
 * @return   Always return 0.
 */
-int polaris10_send_msg_to_smc_without_waiting(struct pp_smumgr *smumgr, uint16_t msg)
+static int
+polaris10_send_msg_to_smc_without_waiting(struct pp_smumgr *smumgr,
+		uint16_t msg)
 {
 	cgs_write_register(smumgr->device, mmSMC_MESSAGE_0, msg);
 
@@ -287,7 +290,9 @@ int polaris10_send_msg_to_smc_without_waiting(struct pp_smumgr *smumgr, uint16_t
 * @param    parameter: the parameter to send
 * @return   The response that came from the SMC.
 */
-int polaris10_send_msg_to_smc_with_parameter(struct pp_smumgr *smumgr, uint16_t msg, uint32_t parameter)
+static int
+polaris10_send_msg_to_smc_with_parameter(struct pp_smumgr *smumgr,
+		uint16_t msg, uint32_t parameter)
 {
 	if (!polaris10_is_smc_ram_running(smumgr)) {
 		return -1;
@@ -316,7 +321,7 @@ int polaris10_send_msg_to_smc_with_parameter_without_waiting(struct pp_smumgr *s
 	return polaris10_send_msg_to_smc_without_waiting(smumgr, msg);
 }
 
-int polaris10_send_msg_to_smc_offset(struct pp_smumgr *smumgr)
+static int polaris10_send_msg_to_smc_offset(struct pp_smumgr *smumgr)
 {
 	cgs_write_register(smumgr->device, mmSMC_MSG_ARG_0, 0x20000);
 
@@ -686,7 +691,7 @@ static int polaris10_perform_btc(struct pp_smumgr *smumgr)
 }
 
 
-int polaris10_setup_graphics_level_structure(struct pp_smumgr *smumgr)
+static int polaris10_setup_graphics_level_structure(struct pp_smumgr *smumgr)
 {
 	uint32_t vr_config;
 	uint32_t dpm_table_start;
@@ -740,7 +745,8 @@ int polaris10_setup_graphics_level_structure(struct pp_smumgr *smumgr)
 	return 0;
 }
 
-int polaris10_avfs_event_mgr(struct pp_smumgr *smumgr, bool SMU_VFT_INTACT)
+static int
+polaris10_avfs_event_mgr(struct pp_smumgr *smumgr, bool SMU_VFT_INTACT)
 {
 	struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(smumgr->backend);
 
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
index f42c536..2efdd98 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
@@ -143,7 +143,7 @@ out:
 }
 
 
-int tonga_program_jump_on_start(struct pp_smumgr *smumgr)
+static int tonga_program_jump_on_start(struct pp_smumgr *smumgr)
 {
 	static const unsigned char pData[] = { 0xE0, 0x00, 0x80, 0x40 };
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1486208

FromArnd Bergmann <arnd@arndb.de>
Date2016-09-19 09:40 +0200
Message-ID<sj1lf-2uv-17@gated-at.bofh.it>
In reply to#1486196
On Monday, September 19, 2016 3:28:39 PM CEST Baoyou Xie wrote:
> We get a few warnings when building kernel with W=1:
> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/tonga_smumgr.c:146:5: warning: no previous prototype for 'tonga_program_jump_on_start' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/fiji_smumgr.c:816:5: warning: no previous prototype for 'fiji_save_vft_table' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/polaris10_smumgr.c:743:5: warning: no previous prototype for 'polaris10_avfs_event_mgr' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/iceland_smumgr.c:167:5: warning: no previous prototype for 'iceland_program_jump_on_start' [-Wmissing-prototypes]
> ....
> 
> In fact, these functions are only used in the file in which they are
> declared and don't need a declaration, but can be made static.
> So this patch marks these functions with 'static'.
> 
> Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
> 

Hi Baoyou,

All your drm/amd patches seem fine to me, but again (as with the nouveau
driver patches before), I think it would make more sense to consolidate
them, and do a small number of patches such as

[PATCH 1/3] drm/amdgpu: add missing includes
[PATCH 2/3] drm/amdgpu: remove unused functions
[PATCH 3/3] drm/amdgpu: mark symbol static where possible

This is all one big driver, and I see no value in splitting it up
per file within the driver.

	Arnd

[toc] | [prev] | [next] | [standalone]


#1486234

FromArnd Bergmann <arnd@arndb.de>
Date2016-09-19 10:10 +0200
Message-ID<sj1Oi-2Ug-13@gated-at.bofh.it>
In reply to#1486208
On Monday, September 19, 2016 9:59:56 AM CEST Christian König wrote:
> Am 19.09.2016 um 09:34 schrieb Arnd Bergmann:
> > On Monday, September 19, 2016 3:28:39 PM CEST Baoyou Xie wrote:
> >> We get a few warnings when building kernel with W=1:
> >> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/tonga_smumgr.c:146:5: warning: no previous prototype for 'tonga_program_jump_on_start' [-Wmissing-prototypes]
> >> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/fiji_smumgr.c:816:5: warning: no previous prototype for 'fiji_save_vft_table' [-Wmissing-prototypes]
> >> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/polaris10_smumgr.c:743:5: warning: no previous prototype for 'polaris10_avfs_event_mgr' [-Wmissing-prototypes]
> >> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/iceland_smumgr.c:167:5: warning: no previous prototype for 'iceland_program_jump_on_start' [-Wmissing-prototypes]
> >> ....
> >>
> >> In fact, these functions are only used in the file in which they are
> >> declared and don't need a declaration, but can be made static.
> >> So this patch marks these functions with 'static'.
> >>
> >> Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
> >>
> > Hi Baoyou,
> >
> > All your drm/amd patches seem fine to me, but again (as with the nouveau
> > driver patches before), I think it would make more sense to consolidate
> > them, and do a small number of patches such as
> >
> > [PATCH 1/3] drm/amdgpu: add missing includes
> > [PATCH 2/3] drm/amdgpu: remove unused functions
> > [PATCH 3/3] drm/amdgpu: mark symbol static where possible
> >
> > This is all one big driver,
> 
> No it isn't. The different parts are developed by different teams at 
> AMD, so the splitting them up is rather welcome here.
> 
> So please keep your style as it is, at least for the amdgpu driver.

Ok, fair enough. Thanks for the clarification!

	Arnd

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web