diff mbox series

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

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

Commit Message

Fabio Estevam Aug. 20, 2024, 1:26 a.m. UTC
From: Fabio Estevam <festevam@denx.de>

The combined usage of pm_sleep_ptr() and DEFINE_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>
---
Changes since v1:
- Use DEFINE_SIMPLE_DEV_PM_OPS() to fix build warnings.

 drivers/thermal/qoriq_thermal.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Daniel Lezcano Sept. 2, 2024, 11:18 a.m. UTC | #1
On 20/08/2024 03:26, Fabio Estevam wrote:
> From: Fabio Estevam <festevam@denx.de>
> 
> The combined usage of pm_sleep_ptr() and DEFINE_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>
> ---

Patches applied, thanks
diff mbox series

Patch

diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
index 404f01cca4da..52e26be8c53d 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);
@@ -374,8 +374,8 @@  static int __maybe_unused qoriq_tmu_resume(struct device *dev)
 	return regmap_update_bits(data->regmap, REGS_TMR, TMR_ME, TMR_ME);
 }
 
-static SIMPLE_DEV_PM_OPS(qoriq_tmu_pm_ops,
-			 qoriq_tmu_suspend, qoriq_tmu_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(qoriq_tmu_pm_ops,
+				qoriq_tmu_suspend, qoriq_tmu_resume);
 
 static const struct of_device_id qoriq_tmu_match[] = {
 	{ .compatible = "fsl,qoriq-tmu", },
@@ -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,