Skip to contentSkip to conversation

thermal: qoriq: Remove __maybe_unused notations

PATCH Applied Fabio Estevam 3 participants 4 messages Aug 19, 2024 – Aug 20, 2024

Subsystems (2)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/2 thermal: qoriq: Remove __maybe_unused notations

From: Fabio Estevam <[email protected]>

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.

---
 drivers/thermal/qoriq_thermal.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/thermal/qoriq_thermal.c +3 -3
index 404f01cca4da..4ace3b2a3d30 100644
@@ -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,
Signature · 1 line
2.34.1
author reviewer
#1 lore raw

PATCH 2/2 thermal: imx: Remove __maybe_unused notations

From: Fabio Estevam <[email protected]>

Replace SET_RUNTIME_PM_OPS()/SET SYSTEM_SLEEP_PM_OPS() with their modern RUNTIME_PM_OPS() and SYSTEM_SLEEP_PM_OPS() alternatives.

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

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

---
 drivers/thermal/imx_thermal.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/thermal/imx_thermal.c +8 -8
index 091fb30dedf3..495ff2eeb0a1 100644
@@ -773,7 +773,7 @@ static void imx_thermal_remove(struct platform_device *pdev)
 	imx_thermal_unregister_legacy_cooling(data);
 }
 
-static int __maybe_unused imx_thermal_suspend(struct device *dev)
+static int imx_thermal_suspend(struct device *dev)
 {
 	struct imx_thermal_data *data = dev_get_drvdata(dev);
 	int ret;
@@ -792,7 +792,7 @@ static int __maybe_unused imx_thermal_suspend(struct device *dev)
 	return pm_runtime_force_suspend(data->dev);
 }
 
-static int __maybe_unused imx_thermal_resume(struct device *dev)
+static int imx_thermal_resume(struct device *dev)
 {
 	struct imx_thermal_data *data = dev_get_drvdata(dev);
 	int ret;
@@ -804,7 +804,7 @@ static int __maybe_unused imx_thermal_resume(struct device *dev)
 	return thermal_zone_device_enable(data->tz);
 }
 
-static int __maybe_unused imx_thermal_runtime_suspend(struct device *dev)
+static int imx_thermal_runtime_suspend(struct device *dev)
 {
 	struct imx_thermal_data *data = dev_get_drvdata(dev);
 	const struct thermal_soc_data *socdata = data->socdata;
@@ -826,7 +826,7 @@ static int __maybe_unused imx_thermal_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused imx_thermal_runtime_resume(struct device *dev)
+static int imx_thermal_runtime_resume(struct device *dev)
 {
 	struct imx_thermal_data *data = dev_get_drvdata(dev);
 	const struct thermal_soc_data *socdata = data->socdata;
@@ -857,15 +857,15 @@ static int __maybe_unused imx_thermal_runtime_resume(struct device *dev)
 }
 
 static const struct dev_pm_ops imx_thermal_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(imx_thermal_suspend, imx_thermal_resume)
-	SET_RUNTIME_PM_OPS(imx_thermal_runtime_suspend,
-			   imx_thermal_runtime_resume, NULL)
+	SYSTEM_SLEEP_PM_OPS(imx_thermal_suspend, imx_thermal_resume)
+	RUNTIME_PM_OPS(imx_thermal_runtime_suspend,
+		       imx_thermal_runtime_resume, NULL)
 };
 
 static struct platform_driver imx_thermal = {
 	.driver = {
 		.name	= "imx_thermal",
-		.pm	= &imx_thermal_pm_ops,
+		.pm	= pm_ptr(&imx_thermal_pm_ops),
 		.of_match_table = of_imx_thermal_match,
 	},
 	.probe		= imx_thermal_probe,
Signature · 1 line
2.34.1
#2 lore raw
In reply to Fabio Estevam
Quoted 11 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

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.

---

Applied, thanks

Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#3 lore raw
In reply to Fabio Estevam
kernel test robot noticed the following build warnings:

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/[email protected]/config)
compiler: alpha-linux-gcc (GCC) 13.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240820/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

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

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki