diff mbox series

[1/2] thermal: qoriq: Remove __maybe_unused notations

Message ID 20240819142700.1206586-1-festevam@gmail.com
State New
Headers show
Series [1/2] thermal: qoriq: Remove __maybe_unused notations | expand

Commit Message

Fabio Estevam Aug. 19, 2024, 2:26 p.m. UTC
From: Fabio Estevam <festevam@denx.de>

The combined usage of pm_sleep_ptr() and SIMPLE_DEV_PM_OPS()
allows the compiler to evaluate if the suspend/resume() functions
are used at build time or are simply dead code.

This allows removing __maybe_unused notations from the suspend/resume()
functions.

Signed-off-by: Fabio Estevam <festevam@denx.de>
---
 drivers/thermal/qoriq_thermal.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Daniel Lezcano Aug. 19, 2024, 6:20 p.m. UTC | #1
On 19/08/2024 16:26, Fabio Estevam wrote:
> From: Fabio Estevam <festevam@denx.de>
> 
> The combined usage of pm_sleep_ptr() and SIMPLE_DEV_PM_OPS()
> allows the compiler to evaluate if the suspend/resume() functions
> are used at build time or are simply dead code.
> 
> This allows removing __maybe_unused notations from the suspend/resume()
> functions.
> 
> Signed-off-by: Fabio Estevam <festevam@denx.de>
> ---

Applied, thanks
kernel test robot Aug. 20, 2024, 1:12 a.m. UTC | #2
Hi Fabio,

kernel test robot noticed the following build warnings:

[auto build test WARNING on rafael-pm/thermal]
[also build test WARNING on linus/master v6.11-rc4 next-20240819]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Fabio-Estevam/thermal-imx-Remove-__maybe_unused-notations/20240819-222757
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git thermal
patch link:    https://lore.kernel.org/r/20240819142700.1206586-1-festevam%40gmail.com
patch subject: [PATCH 1/2] thermal: qoriq: Remove __maybe_unused notations
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20240820/202408200829.1ywCKDAw-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 13.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240820/202408200829.1ywCKDAw-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408200829.1ywCKDAw-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/thermal/qoriq_thermal.c:364:12: warning: 'qoriq_tmu_resume' defined but not used [-Wunused-function]
     364 | static int qoriq_tmu_resume(struct device *dev)
         |            ^~~~~~~~~~~~~~~~
>> drivers/thermal/qoriq_thermal.c:350:12: warning: 'qoriq_tmu_suspend' defined but not used [-Wunused-function]
     350 | static int qoriq_tmu_suspend(struct device *dev)
         |            ^~~~~~~~~~~~~~~~~


vim +/qoriq_tmu_resume +364 drivers/thermal/qoriq_thermal.c

   349	
 > 350	static int qoriq_tmu_suspend(struct device *dev)
   351	{
   352		struct qoriq_tmu_data *data = dev_get_drvdata(dev);
   353		int ret;
   354	
   355		ret = regmap_update_bits(data->regmap, REGS_TMR, TMR_ME, 0);
   356		if (ret)
   357			return ret;
   358	
   359		clk_disable_unprepare(data->clk);
   360	
   361		return 0;
   362	}
   363	
 > 364	static int qoriq_tmu_resume(struct device *dev)
   365	{
   366		int ret;
   367		struct qoriq_tmu_data *data = dev_get_drvdata(dev);
   368	
   369		ret = clk_prepare_enable(data->clk);
   370		if (ret)
   371			return ret;
   372	
   373		/* Enable monitoring */
   374		return regmap_update_bits(data->regmap, REGS_TMR, TMR_ME, TMR_ME);
   375	}
   376
diff mbox series

Patch

diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
index 404f01cca4da..4ace3b2a3d30 100644
--- a/drivers/thermal/qoriq_thermal.c
+++ b/drivers/thermal/qoriq_thermal.c
@@ -347,7 +347,7 @@  static int qoriq_tmu_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int __maybe_unused qoriq_tmu_suspend(struct device *dev)
+static int qoriq_tmu_suspend(struct device *dev)
 {
 	struct qoriq_tmu_data *data = dev_get_drvdata(dev);
 	int ret;
@@ -361,7 +361,7 @@  static int __maybe_unused qoriq_tmu_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused qoriq_tmu_resume(struct device *dev)
+static int qoriq_tmu_resume(struct device *dev)
 {
 	int ret;
 	struct qoriq_tmu_data *data = dev_get_drvdata(dev);
@@ -387,7 +387,7 @@  MODULE_DEVICE_TABLE(of, qoriq_tmu_match);
 static struct platform_driver qoriq_tmu = {
 	.driver	= {
 		.name		= "qoriq_thermal",
-		.pm		= &qoriq_tmu_pm_ops,
+		.pm		= pm_sleep_ptr(&qoriq_tmu_pm_ops),
 		.of_match_table	= qoriq_tmu_match,
 	},
 	.probe	= qoriq_tmu_probe,