All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clocksource: ingenic-timer: Use pm_sleep_ptr() macro
@ 2023-06-18 15:39 Paul Cercueil
  2023-06-19 14:18 ` Daniel Lezcano
  2023-06-26  9:11 ` [tip: timers/core] clocksource/drivers/ingenic-timer: " tip-bot2 for Paul Cercueil
  0 siblings, 2 replies; 3+ messages in thread
From: Paul Cercueil @ 2023-06-18 15:39 UTC (permalink / raw)
  To: Daniel Lezcano, Thomas Gleixner; +Cc: list, linux-kernel, Paul Cercueil

The use of the pm_sleep_ptr() macro allows the compiler to always see
the dev_pm_ops structure and related functions, while still allowing the
unused code to be removed, without the need for the __maybe_unused
markings.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/clocksource/ingenic-timer.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/clocksource/ingenic-timer.c b/drivers/clocksource/ingenic-timer.c
index 089ce64b1c3f..154ee5f7954a 100644
--- a/drivers/clocksource/ingenic-timer.c
+++ b/drivers/clocksource/ingenic-timer.c
@@ -369,7 +369,7 @@ static int __init ingenic_tcu_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int __maybe_unused ingenic_tcu_suspend(struct device *dev)
+static int ingenic_tcu_suspend(struct device *dev)
 {
 	struct ingenic_tcu *tcu = dev_get_drvdata(dev);
 	unsigned int cpu;
@@ -382,7 +382,7 @@ static int __maybe_unused ingenic_tcu_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused ingenic_tcu_resume(struct device *dev)
+static int ingenic_tcu_resume(struct device *dev)
 {
 	struct ingenic_tcu *tcu = dev_get_drvdata(dev);
 	unsigned int cpu;
@@ -406,7 +406,7 @@ static int __maybe_unused ingenic_tcu_resume(struct device *dev)
 	return ret;
 }
 
-static const struct dev_pm_ops __maybe_unused ingenic_tcu_pm_ops = {
+static const struct dev_pm_ops ingenic_tcu_pm_ops = {
 	/* _noirq: We want the TCU clocks to be gated last / ungated first */
 	.suspend_noirq = ingenic_tcu_suspend,
 	.resume_noirq  = ingenic_tcu_resume,
@@ -415,9 +415,7 @@ static const struct dev_pm_ops __maybe_unused ingenic_tcu_pm_ops = {
 static struct platform_driver ingenic_tcu_driver = {
 	.driver = {
 		.name	= "ingenic-tcu-timer",
-#ifdef CONFIG_PM_SLEEP
-		.pm	= &ingenic_tcu_pm_ops,
-#endif
+		.pm	= pm_sleep_ptr(&ingenic_tcu_pm_ops),
 		.of_match_table = ingenic_tcu_of_match,
 	},
 };
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] clocksource: ingenic-timer: Use pm_sleep_ptr() macro
  2023-06-18 15:39 [PATCH] clocksource: ingenic-timer: Use pm_sleep_ptr() macro Paul Cercueil
@ 2023-06-19 14:18 ` Daniel Lezcano
  2023-06-26  9:11 ` [tip: timers/core] clocksource/drivers/ingenic-timer: " tip-bot2 for Paul Cercueil
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Lezcano @ 2023-06-19 14:18 UTC (permalink / raw)
  To: Paul Cercueil, Thomas Gleixner; +Cc: list, linux-kernel

On 18/06/2023 17:39, Paul Cercueil wrote:
> The use of the pm_sleep_ptr() macro allows the compiler to always see
> the dev_pm_ops structure and related functions, while still allowing the
> unused code to be removed, without the need for the __maybe_unused
> markings.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---

Applied thanks


-- 
<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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip: timers/core] clocksource/drivers/ingenic-timer: Use pm_sleep_ptr() macro
  2023-06-18 15:39 [PATCH] clocksource: ingenic-timer: Use pm_sleep_ptr() macro Paul Cercueil
  2023-06-19 14:18 ` Daniel Lezcano
@ 2023-06-26  9:11 ` tip-bot2 for Paul Cercueil
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Paul Cercueil @ 2023-06-26  9:11 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Paul Cercueil, Daniel Lezcano, x86, linux-kernel

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     ea95051063f95bf612683f5697e44604d0cbd0f1
Gitweb:        https://git.kernel.org/tip/ea95051063f95bf612683f5697e44604d0cbd0f1
Author:        Paul Cercueil <paul@crapouillou.net>
AuthorDate:    Sun, 18 Jun 2023 17:39:37 +02:00
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Mon, 19 Jun 2023 16:17:42 +02:00

clocksource/drivers/ingenic-timer: Use pm_sleep_ptr() macro

The use of the pm_sleep_ptr() macro allows the compiler to always see
the dev_pm_ops structure and related functions, while still allowing the
unused code to be removed, without the need for the __maybe_unused
markings.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230618153937.96649-1-paul@crapouillou.net
---
 drivers/clocksource/ingenic-timer.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/clocksource/ingenic-timer.c b/drivers/clocksource/ingenic-timer.c
index 089ce64..154ee5f 100644
--- a/drivers/clocksource/ingenic-timer.c
+++ b/drivers/clocksource/ingenic-timer.c
@@ -369,7 +369,7 @@ static int __init ingenic_tcu_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int __maybe_unused ingenic_tcu_suspend(struct device *dev)
+static int ingenic_tcu_suspend(struct device *dev)
 {
 	struct ingenic_tcu *tcu = dev_get_drvdata(dev);
 	unsigned int cpu;
@@ -382,7 +382,7 @@ static int __maybe_unused ingenic_tcu_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused ingenic_tcu_resume(struct device *dev)
+static int ingenic_tcu_resume(struct device *dev)
 {
 	struct ingenic_tcu *tcu = dev_get_drvdata(dev);
 	unsigned int cpu;
@@ -406,7 +406,7 @@ err_timer_clk_disable:
 	return ret;
 }
 
-static const struct dev_pm_ops __maybe_unused ingenic_tcu_pm_ops = {
+static const struct dev_pm_ops ingenic_tcu_pm_ops = {
 	/* _noirq: We want the TCU clocks to be gated last / ungated first */
 	.suspend_noirq = ingenic_tcu_suspend,
 	.resume_noirq  = ingenic_tcu_resume,
@@ -415,9 +415,7 @@ static const struct dev_pm_ops __maybe_unused ingenic_tcu_pm_ops = {
 static struct platform_driver ingenic_tcu_driver = {
 	.driver = {
 		.name	= "ingenic-tcu-timer",
-#ifdef CONFIG_PM_SLEEP
-		.pm	= &ingenic_tcu_pm_ops,
-#endif
+		.pm	= pm_sleep_ptr(&ingenic_tcu_pm_ops),
 		.of_match_table = ingenic_tcu_of_match,
 	},
 };

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-26  9:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-18 15:39 [PATCH] clocksource: ingenic-timer: Use pm_sleep_ptr() macro Paul Cercueil
2023-06-19 14:18 ` Daniel Lezcano
2023-06-26  9:11 ` [tip: timers/core] clocksource/drivers/ingenic-timer: " tip-bot2 for Paul Cercueil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.