Message ID | 20220505121958.138905-1-renzhijie2@huawei.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
Series | [-next] platform/x86: amd-pmc: Fix build error unused-function | expand |
Hi, On 5/5/22 14:19, Ren Zhijie wrote: > If CONFIG_SUSPEND and CONFIG_DEBUG_FS are not set. > > compile error: > drivers/platform/x86/amd-pmc.c:323:12: error: ‘get_metrics_table’ defined but not used [-Werror=unused-function] > static int get_metrics_table(struct amd_pmc_dev *pdev, struct smu_metrics *table) > ^~~~~~~~~~~~~~~~~ > drivers/platform/x86/amd-pmc.c:298:12: error: ‘amd_pmc_idlemask_read’ defined but not used [-Werror=unused-function] > static int amd_pmc_idlemask_read(struct amd_pmc_dev *pdev, struct device *dev, > ^~~~~~~~~~~~~~~~~~~~~ > drivers/platform/x86/amd-pmc.c:196:12: error: ‘amd_pmc_get_smu_version’ defined but not used [-Werror=unused-function] > static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev) > ^~~~~~~~~~~~~~~~~~~~~~~ > cc1: all warnings being treated as errors > > To fix building warning, wrap all related code with CONFIG_SUSPEND or CONFIG_DEBUG_FS. > > Reported-by: Hulk Robot <hulkci@huawei.com> > Signed-off-by: Ren Zhijie <renzhijie2@huawei.com> Thanks for the patch, the issue with amd_pmc_get_smu_version() not being wrapped in #ifdef CONFIG_DEBUG_FS was already fixed by: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/commit/?h=for-next&id=acd51562e07d17aaf4ac652f1dc55c743685bf41 Moving amd_pmc_setup_smu_logging + amd_pmc_idlemask_read + get_metrics_table under: #if defined(CONFIG_SUSPEND) || defined(CONFIG_DEBUG_FS) is still necessary though, so I've merged that part of your patch: Thank you for your patch, I've applied this patch to my review-hans branch: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while. Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window. Regards, Hans > --- > drivers/platform/x86/amd-pmc.c | 72 ++++++++++++++++++---------------- > 1 file changed, 39 insertions(+), 33 deletions(-) > > diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd-pmc.c > index 668a1d6c11ee..8f004673b23f 100644 > --- a/drivers/platform/x86/amd-pmc.c > +++ b/drivers/platform/x86/amd-pmc.c > @@ -164,7 +164,6 @@ static int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf); > #ifdef CONFIG_SUSPEND > static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data); > #endif > -static int amd_pmc_setup_smu_logging(struct amd_pmc_dev *dev); > > static inline u32 amd_pmc_reg_read(struct amd_pmc_dev *dev, int reg_offset) > { > @@ -193,6 +192,7 @@ struct smu_metrics { > u64 timecondition_notmet_totaltime[SOC_SUBSYSTEM_IP_MAX]; > } __packed; > > +#ifdef CONFIG_DEBUG_FS > static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev) > { > int rc; > @@ -212,6 +212,7 @@ static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev) > > return 0; > } > +#endif /* CONFIG_DEBUG_FS */ > > static int amd_pmc_stb_debugfs_open(struct inode *inode, struct file *filp) > { > @@ -295,6 +296,9 @@ static const struct file_operations amd_pmc_stb_debugfs_fops_v2 = { > .release = amd_pmc_stb_debugfs_release_v2, > }; > > +#if defined(CONFIG_SUSPEND) || defined(CONFIG_DEBUG_FS) > +static int amd_pmc_setup_smu_logging(struct amd_pmc_dev *dev); > + > static int amd_pmc_idlemask_read(struct amd_pmc_dev *pdev, struct device *dev, > struct seq_file *s) > { > @@ -335,6 +339,40 @@ static int get_metrics_table(struct amd_pmc_dev *pdev, struct smu_metrics *table > return 0; > } > > +static int amd_pmc_setup_smu_logging(struct amd_pmc_dev *dev) > +{ > + if (dev->cpu_id == AMD_CPU_ID_PCO) { > + dev_warn_once(dev->dev, "SMU debugging info not supported on this platform\n"); > + return -EINVAL; > + } > + > + /* Get Active devices list from SMU */ > + if (!dev->active_ips) > + amd_pmc_send_cmd(dev, 0, &dev->active_ips, SMU_MSG_GET_SUP_CONSTRAINTS, 1); > + > + /* Get dram address */ > + if (!dev->smu_virt_addr) { > + u32 phys_addr_low, phys_addr_hi; > + u64 smu_phys_addr; > + > + amd_pmc_send_cmd(dev, 0, &phys_addr_low, SMU_MSG_LOG_GETDRAM_ADDR_LO, 1); > + amd_pmc_send_cmd(dev, 0, &phys_addr_hi, SMU_MSG_LOG_GETDRAM_ADDR_HI, 1); > + smu_phys_addr = ((u64)phys_addr_hi << 32 | phys_addr_low); > + > + dev->smu_virt_addr = devm_ioremap(dev->dev, smu_phys_addr, > + sizeof(struct smu_metrics)); > + if (!dev->smu_virt_addr) > + return -ENOMEM; > + } > + > + /* Start the logging */ > + amd_pmc_send_cmd(dev, 0, NULL, SMU_MSG_LOG_RESET, 0); > + amd_pmc_send_cmd(dev, 0, NULL, SMU_MSG_LOG_START, 0); > + > + return 0; > +} > +#endif /* CONFIG_SUSPEND || CONFIG_DEBUG_FS */ > + > #ifdef CONFIG_SUSPEND > static void amd_pmc_validate_deepest(struct amd_pmc_dev *pdev) > { > @@ -475,38 +513,6 @@ static inline void amd_pmc_dbgfs_unregister(struct amd_pmc_dev *dev) > } > #endif /* CONFIG_DEBUG_FS */ > > -static int amd_pmc_setup_smu_logging(struct amd_pmc_dev *dev) > -{ > - if (dev->cpu_id == AMD_CPU_ID_PCO) { > - dev_warn_once(dev->dev, "SMU debugging info not supported on this platform\n"); > - return -EINVAL; > - } > - > - /* Get Active devices list from SMU */ > - if (!dev->active_ips) > - amd_pmc_send_cmd(dev, 0, &dev->active_ips, SMU_MSG_GET_SUP_CONSTRAINTS, 1); > - > - /* Get dram address */ > - if (!dev->smu_virt_addr) { > - u32 phys_addr_low, phys_addr_hi; > - u64 smu_phys_addr; > - > - amd_pmc_send_cmd(dev, 0, &phys_addr_low, SMU_MSG_LOG_GETDRAM_ADDR_LO, 1); > - amd_pmc_send_cmd(dev, 0, &phys_addr_hi, SMU_MSG_LOG_GETDRAM_ADDR_HI, 1); > - smu_phys_addr = ((u64)phys_addr_hi << 32 | phys_addr_low); > - > - dev->smu_virt_addr = devm_ioremap(dev->dev, smu_phys_addr, > - sizeof(struct smu_metrics)); > - if (!dev->smu_virt_addr) > - return -ENOMEM; > - } > - > - /* Start the logging */ > - amd_pmc_send_cmd(dev, 0, NULL, SMU_MSG_LOG_RESET, 0); > - amd_pmc_send_cmd(dev, 0, NULL, SMU_MSG_LOG_START, 0); > - > - return 0; > -} > > static void amd_pmc_dump_registers(struct amd_pmc_dev *dev) > {
在 2022/5/6 18:37, Hans de Goede 写道: > Hi, > > On 5/5/22 14:19, Ren Zhijie wrote: >> If CONFIG_SUSPEND and CONFIG_DEBUG_FS are not set. >> >> compile error: >> drivers/platform/x86/amd-pmc.c:323:12: error: ‘get_metrics_table’ defined but not used [-Werror=unused-function] >> static int get_metrics_table(struct amd_pmc_dev *pdev, struct smu_metrics *table) >> ^~~~~~~~~~~~~~~~~ >> drivers/platform/x86/amd-pmc.c:298:12: error: ‘amd_pmc_idlemask_read’ defined but not used [-Werror=unused-function] >> static int amd_pmc_idlemask_read(struct amd_pmc_dev *pdev, struct device *dev, >> ^~~~~~~~~~~~~~~~~~~~~ >> drivers/platform/x86/amd-pmc.c:196:12: error: ‘amd_pmc_get_smu_version’ defined but not used [-Werror=unused-function] >> static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev) >> ^~~~~~~~~~~~~~~~~~~~~~~ >> cc1: all warnings being treated as errors >> >> To fix building warning, wrap all related code with CONFIG_SUSPEND or CONFIG_DEBUG_FS. >> >> Reported-by: Hulk Robot <hulkci@huawei.com> >> Signed-off-by: Ren Zhijie <renzhijie2@huawei.com> > Thanks for the patch, the issue with amd_pmc_get_smu_version() not being > wrapped in #ifdef CONFIG_DEBUG_FS was already fixed by: > https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/commit/?h=for-next&id=acd51562e07d17aaf4ac652f1dc55c743685bf41 > > Moving amd_pmc_setup_smu_logging + amd_pmc_idlemask_read + > get_metrics_table under: > > #if defined(CONFIG_SUSPEND) || defined(CONFIG_DEBUG_FS) > > is still necessary though, so I've merged that part of your patch: > > Thank you for your patch, I've applied this patch to my review-hans > branch: > https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans > > Note it will show up in my review-hans branch once I've pushed my > local branch there, which might take a while. > > Once I've run some tests on this branch the patches there will be > added to the platform-drivers-x86/for-next branch and eventually > will be included in the pdx86 pull-request to Linus for the next > merge-window. > > Regards, > > Hans Glad that I could help Regards, Ren > >> --- >> drivers/platform/x86/amd-pmc.c | 72 ++++++++++++++++++---------------- >> 1 file changed, 39 insertions(+), 33 deletions(-) >> >> diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd-pmc.c >> index 668a1d6c11ee..8f004673b23f 100644 >> --- a/drivers/platform/x86/amd-pmc.c >> +++ b/drivers/platform/x86/amd-pmc.c >> @@ -164,7 +164,6 @@ static int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf); >> #ifdef CONFIG_SUSPEND >> static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data); >> #endif >> -static int amd_pmc_setup_smu_logging(struct amd_pmc_dev *dev); >> >> static inline u32 amd_pmc_reg_read(struct amd_pmc_dev *dev, int reg_offset) >> { >> @@ -193,6 +192,7 @@ struct smu_metrics { >> u64 timecondition_notmet_totaltime[SOC_SUBSYSTEM_IP_MAX]; >> } __packed; >> >> +#ifdef CONFIG_DEBUG_FS >> static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev) >> { >> int rc; >> @@ -212,6 +212,7 @@ static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev) >> >> return 0; >> } >> +#endif /* CONFIG_DEBUG_FS */ >> >> static int amd_pmc_stb_debugfs_open(struct inode *inode, struct file *filp) >> { >> @@ -295,6 +296,9 @@ static const struct file_operations amd_pmc_stb_debugfs_fops_v2 = { >> .release = amd_pmc_stb_debugfs_release_v2, >> }; >> >> +#if defined(CONFIG_SUSPEND) || defined(CONFIG_DEBUG_FS) >> +static int amd_pmc_setup_smu_logging(struct amd_pmc_dev *dev); >> + >> static int amd_pmc_idlemask_read(struct amd_pmc_dev *pdev, struct device *dev, >> struct seq_file *s) >> { >> @@ -335,6 +339,40 @@ static int get_metrics_table(struct amd_pmc_dev *pdev, struct smu_metrics *table >> return 0; >> } >> >> +static int amd_pmc_setup_smu_logging(struct amd_pmc_dev *dev) >> +{ >> + if (dev->cpu_id == AMD_CPU_ID_PCO) { >> + dev_warn_once(dev->dev, "SMU debugging info not supported on this platform\n"); >> + return -EINVAL; >> + } >> + >> + /* Get Active devices list from SMU */ >> + if (!dev->active_ips) >> + amd_pmc_send_cmd(dev, 0, &dev->active_ips, SMU_MSG_GET_SUP_CONSTRAINTS, 1); >> + >> + /* Get dram address */ >> + if (!dev->smu_virt_addr) { >> + u32 phys_addr_low, phys_addr_hi; >> + u64 smu_phys_addr; >> + >> + amd_pmc_send_cmd(dev, 0, &phys_addr_low, SMU_MSG_LOG_GETDRAM_ADDR_LO, 1); >> + amd_pmc_send_cmd(dev, 0, &phys_addr_hi, SMU_MSG_LOG_GETDRAM_ADDR_HI, 1); >> + smu_phys_addr = ((u64)phys_addr_hi << 32 | phys_addr_low); >> + >> + dev->smu_virt_addr = devm_ioremap(dev->dev, smu_phys_addr, >> + sizeof(struct smu_metrics)); >> + if (!dev->smu_virt_addr) >> + return -ENOMEM; >> + } >> + >> + /* Start the logging */ >> + amd_pmc_send_cmd(dev, 0, NULL, SMU_MSG_LOG_RESET, 0); >> + amd_pmc_send_cmd(dev, 0, NULL, SMU_MSG_LOG_START, 0); >> + >> + return 0; >> +} >> +#endif /* CONFIG_SUSPEND || CONFIG_DEBUG_FS */ >> + >> #ifdef CONFIG_SUSPEND >> static void amd_pmc_validate_deepest(struct amd_pmc_dev *pdev) >> { >> @@ -475,38 +513,6 @@ static inline void amd_pmc_dbgfs_unregister(struct amd_pmc_dev *dev) >> } >> #endif /* CONFIG_DEBUG_FS */ >> >> -static int amd_pmc_setup_smu_logging(struct amd_pmc_dev *dev) >> -{ >> - if (dev->cpu_id == AMD_CPU_ID_PCO) { >> - dev_warn_once(dev->dev, "SMU debugging info not supported on this platform\n"); >> - return -EINVAL; >> - } >> - >> - /* Get Active devices list from SMU */ >> - if (!dev->active_ips) >> - amd_pmc_send_cmd(dev, 0, &dev->active_ips, SMU_MSG_GET_SUP_CONSTRAINTS, 1); >> - >> - /* Get dram address */ >> - if (!dev->smu_virt_addr) { >> - u32 phys_addr_low, phys_addr_hi; >> - u64 smu_phys_addr; >> - >> - amd_pmc_send_cmd(dev, 0, &phys_addr_low, SMU_MSG_LOG_GETDRAM_ADDR_LO, 1); >> - amd_pmc_send_cmd(dev, 0, &phys_addr_hi, SMU_MSG_LOG_GETDRAM_ADDR_HI, 1); >> - smu_phys_addr = ((u64)phys_addr_hi << 32 | phys_addr_low); >> - >> - dev->smu_virt_addr = devm_ioremap(dev->dev, smu_phys_addr, >> - sizeof(struct smu_metrics)); >> - if (!dev->smu_virt_addr) >> - return -ENOMEM; >> - } >> - >> - /* Start the logging */ >> - amd_pmc_send_cmd(dev, 0, NULL, SMU_MSG_LOG_RESET, 0); >> - amd_pmc_send_cmd(dev, 0, NULL, SMU_MSG_LOG_START, 0); >> - >> - return 0; >> -} >> >> static void amd_pmc_dump_registers(struct amd_pmc_dev *dev) >> { > .
diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd-pmc.c index 668a1d6c11ee..8f004673b23f 100644 --- a/drivers/platform/x86/amd-pmc.c +++ b/drivers/platform/x86/amd-pmc.c @@ -164,7 +164,6 @@ static int amd_pmc_read_stb(struct amd_pmc_dev *dev, u32 *buf); #ifdef CONFIG_SUSPEND static int amd_pmc_write_stb(struct amd_pmc_dev *dev, u32 data); #endif -static int amd_pmc_setup_smu_logging(struct amd_pmc_dev *dev); static inline u32 amd_pmc_reg_read(struct amd_pmc_dev *dev, int reg_offset) { @@ -193,6 +192,7 @@ struct smu_metrics { u64 timecondition_notmet_totaltime[SOC_SUBSYSTEM_IP_MAX]; } __packed; +#ifdef CONFIG_DEBUG_FS static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev) { int rc; @@ -212,6 +212,7 @@ static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev) return 0; } +#endif /* CONFIG_DEBUG_FS */ static int amd_pmc_stb_debugfs_open(struct inode *inode, struct file *filp) { @@ -295,6 +296,9 @@ static const struct file_operations amd_pmc_stb_debugfs_fops_v2 = { .release = amd_pmc_stb_debugfs_release_v2, }; +#if defined(CONFIG_SUSPEND) || defined(CONFIG_DEBUG_FS) +static int amd_pmc_setup_smu_logging(struct amd_pmc_dev *dev); + static int amd_pmc_idlemask_read(struct amd_pmc_dev *pdev, struct device *dev, struct seq_file *s) { @@ -335,6 +339,40 @@ static int get_metrics_table(struct amd_pmc_dev *pdev, struct smu_metrics *table return 0; } +static int amd_pmc_setup_smu_logging(struct amd_pmc_dev *dev) +{ + if (dev->cpu_id == AMD_CPU_ID_PCO) { + dev_warn_once(dev->dev, "SMU debugging info not supported on this platform\n"); + return -EINVAL; + } + + /* Get Active devices list from SMU */ + if (!dev->active_ips) + amd_pmc_send_cmd(dev, 0, &dev->active_ips, SMU_MSG_GET_SUP_CONSTRAINTS, 1); + + /* Get dram address */ + if (!dev->smu_virt_addr) { + u32 phys_addr_low, phys_addr_hi; + u64 smu_phys_addr; + + amd_pmc_send_cmd(dev, 0, &phys_addr_low, SMU_MSG_LOG_GETDRAM_ADDR_LO, 1); + amd_pmc_send_cmd(dev, 0, &phys_addr_hi, SMU_MSG_LOG_GETDRAM_ADDR_HI, 1); + smu_phys_addr = ((u64)phys_addr_hi << 32 | phys_addr_low); + + dev->smu_virt_addr = devm_ioremap(dev->dev, smu_phys_addr, + sizeof(struct smu_metrics)); + if (!dev->smu_virt_addr) + return -ENOMEM; + } + + /* Start the logging */ + amd_pmc_send_cmd(dev, 0, NULL, SMU_MSG_LOG_RESET, 0); + amd_pmc_send_cmd(dev, 0, NULL, SMU_MSG_LOG_START, 0); + + return 0; +} +#endif /* CONFIG_SUSPEND || CONFIG_DEBUG_FS */ + #ifdef CONFIG_SUSPEND static void amd_pmc_validate_deepest(struct amd_pmc_dev *pdev) { @@ -475,38 +513,6 @@ static inline void amd_pmc_dbgfs_unregister(struct amd_pmc_dev *dev) } #endif /* CONFIG_DEBUG_FS */ -static int amd_pmc_setup_smu_logging(struct amd_pmc_dev *dev) -{ - if (dev->cpu_id == AMD_CPU_ID_PCO) { - dev_warn_once(dev->dev, "SMU debugging info not supported on this platform\n"); - return -EINVAL; - } - - /* Get Active devices list from SMU */ - if (!dev->active_ips) - amd_pmc_send_cmd(dev, 0, &dev->active_ips, SMU_MSG_GET_SUP_CONSTRAINTS, 1); - - /* Get dram address */ - if (!dev->smu_virt_addr) { - u32 phys_addr_low, phys_addr_hi; - u64 smu_phys_addr; - - amd_pmc_send_cmd(dev, 0, &phys_addr_low, SMU_MSG_LOG_GETDRAM_ADDR_LO, 1); - amd_pmc_send_cmd(dev, 0, &phys_addr_hi, SMU_MSG_LOG_GETDRAM_ADDR_HI, 1); - smu_phys_addr = ((u64)phys_addr_hi << 32 | phys_addr_low); - - dev->smu_virt_addr = devm_ioremap(dev->dev, smu_phys_addr, - sizeof(struct smu_metrics)); - if (!dev->smu_virt_addr) - return -ENOMEM; - } - - /* Start the logging */ - amd_pmc_send_cmd(dev, 0, NULL, SMU_MSG_LOG_RESET, 0); - amd_pmc_send_cmd(dev, 0, NULL, SMU_MSG_LOG_START, 0); - - return 0; -} static void amd_pmc_dump_registers(struct amd_pmc_dev *dev) {
If CONFIG_SUSPEND and CONFIG_DEBUG_FS are not set. compile error: drivers/platform/x86/amd-pmc.c:323:12: error: ‘get_metrics_table’ defined but not used [-Werror=unused-function] static int get_metrics_table(struct amd_pmc_dev *pdev, struct smu_metrics *table) ^~~~~~~~~~~~~~~~~ drivers/platform/x86/amd-pmc.c:298:12: error: ‘amd_pmc_idlemask_read’ defined but not used [-Werror=unused-function] static int amd_pmc_idlemask_read(struct amd_pmc_dev *pdev, struct device *dev, ^~~~~~~~~~~~~~~~~~~~~ drivers/platform/x86/amd-pmc.c:196:12: error: ‘amd_pmc_get_smu_version’ defined but not used [-Werror=unused-function] static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev) ^~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors To fix building warning, wrap all related code with CONFIG_SUSPEND or CONFIG_DEBUG_FS. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Ren Zhijie <renzhijie2@huawei.com> --- drivers/platform/x86/amd-pmc.c | 72 ++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 33 deletions(-)