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

2016-09-19 Thread Huang Rui
Hi Baoyou,

On Mon, Sep 19, 2016 at 03:28:39PM +0800, 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'.
> 

+ amd-gfx mail list.

Thanks to your patch. But powerplay part is refactored recently below, some
functions are already updated. So you might need rebase them. :-)

https://lists.freedesktop.org/archives/amd-gfx/2016-September/002118.html

Thanks,
Rui


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

2016-09-19 Thread Baoyou Xie
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 
---
 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)
 *
 * @paramsmumgr  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)
 * @parammsg 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)
  * @paramparameter: 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,
 * @paramparameter: 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 

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

2016-09-19 Thread Arnd Bergmann
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 
> >>
> > 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



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

2016-09-19 Thread Christian König
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 
>>
> 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.

Regards,
Christian.

>   and I see no value in splitting it up
> per file within the driver.
>
>   Arnd




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

2016-09-19 Thread 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 
> 

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