All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] clocksource: ingenic-ost: define pm functions properly in platform_driver struct
@ 2022-11-23  8:31 Lukas Bulwahn
  2022-11-23 17:54 ` Paul Cercueil
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Lukas Bulwahn @ 2022-11-23  8:31 UTC (permalink / raw)
  To: Daniel Lezcano, Thomas Gleixner, Paul Cercueil, Maarten ter Huurne
  Cc: kernel-janitors, linux-kernel, Lukas Bulwahn

Commit ca7b72b5a5f2 ("clocksource: Add driver for the Ingenic JZ47xx OST")
adds the struct platform_driver ingenic_ost_driver, with the definition of
pm functions under the non-existing config PM_SUSPEND, which means the
intended pm functions were never actually included in any build.

As the only callbacks are .suspend_noirq and .resume_noirq, we can assume
that it is intended to be CONFIG_PM_SLEEP.

Since commit 1a3c7bb08826 ("PM: core: Add new *_PM_OPS macros, deprecate
old ones"), the default pattern for platform_driver definitions
conditional for CONFIG_PM_SLEEP is to use pm_sleep_ptr().

As __maybe_unused annotations on the dev_pm_ops structure and its callbacks
are not needed anymore, remove these as well.

Suggested-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
---
v1: https://lore.kernel.org/all/20221122141434.30498-1-lukas.bulwahn@gmail.com/

v1 -> v2:
  - incorporated Paul Cercueil's feedback:
    - changed to pm_sleep_ptr
    - dropped Fixes: tag

 drivers/clocksource/ingenic-ost.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/clocksource/ingenic-ost.c b/drivers/clocksource/ingenic-ost.c
index 06d25754e606..9f7c280a1336 100644
--- a/drivers/clocksource/ingenic-ost.c
+++ b/drivers/clocksource/ingenic-ost.c
@@ -141,7 +141,7 @@ static int __init ingenic_ost_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int __maybe_unused ingenic_ost_suspend(struct device *dev)
+static int ingenic_ost_suspend(struct device *dev)
 {
 	struct ingenic_ost *ost = dev_get_drvdata(dev);
 
@@ -150,14 +150,14 @@ static int __maybe_unused ingenic_ost_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused ingenic_ost_resume(struct device *dev)
+static int ingenic_ost_resume(struct device *dev)
 {
 	struct ingenic_ost *ost = dev_get_drvdata(dev);
 
 	return clk_enable(ost->clk);
 }
 
-static const struct dev_pm_ops __maybe_unused ingenic_ost_pm_ops = {
+static const struct dev_pm_ops ingenic_ost_pm_ops = {
 	/* _noirq: We want the OST clock to be gated last / ungated first */
 	.suspend_noirq = ingenic_ost_suspend,
 	.resume_noirq  = ingenic_ost_resume,
@@ -181,9 +181,7 @@ static const struct of_device_id ingenic_ost_of_match[] = {
 static struct platform_driver ingenic_ost_driver = {
 	.driver = {
 		.name = "ingenic-ost",
-#ifdef CONFIG_PM_SUSPEND
-		.pm = &ingenic_ost_pm_ops,
-#endif
+		.pm = pm_sleep_ptr(&ingenic_ost_pm_ops),
 		.of_match_table = ingenic_ost_of_match,
 	},
 };
-- 
2.17.1


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

* Re: [PATCH v2] clocksource: ingenic-ost: define pm functions properly in platform_driver struct
  2022-11-23  8:31 [PATCH v2] clocksource: ingenic-ost: define pm functions properly in platform_driver struct Lukas Bulwahn
@ 2022-11-23 17:54 ` Paul Cercueil
  2022-12-01 11:00 ` Thomas Gleixner
  2022-12-01 11:05 ` [tip: timers/core] clocksource/drivers/ingenic-ost: Define " tip-bot2 for Lukas Bulwahn
  2 siblings, 0 replies; 4+ messages in thread
From: Paul Cercueil @ 2022-11-23 17:54 UTC (permalink / raw)
  To: Lukas Bulwahn
  Cc: Daniel Lezcano, Thomas Gleixner, Maarten ter Huurne,
	kernel-janitors, linux-kernel

Hi Lukas,

Le mer. 23 nov. 2022 à 09:31:59 +0100, Lukas Bulwahn 
<lukas.bulwahn@gmail.com> a écrit :
> Commit ca7b72b5a5f2 ("clocksource: Add driver for the Ingenic JZ47xx 
> OST")
> adds the struct platform_driver ingenic_ost_driver, with the 
> definition of
> pm functions under the non-existing config PM_SUSPEND, which means the
> intended pm functions were never actually included in any build.
> 
> As the only callbacks are .suspend_noirq and .resume_noirq, we can 
> assume
> that it is intended to be CONFIG_PM_SLEEP.
> 
> Since commit 1a3c7bb08826 ("PM: core: Add new *_PM_OPS macros, 
> deprecate
> old ones"), the default pattern for platform_driver definitions
> conditional for CONFIG_PM_SLEEP is to use pm_sleep_ptr().
> 
> As __maybe_unused annotations on the dev_pm_ops structure and its 
> callbacks
> are not needed anymore, remove these as well.
> 
> Suggested-by: Paul Cercueil <paul@crapouillou.net>
> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>

Reviewed-by: Paul Cercueil <paul@crapouillou.net>

Cheers,
-Paul

> ---
> v1: 
> https://lore.kernel.org/all/20221122141434.30498-1-lukas.bulwahn@gmail.com/
> 
> v1 -> v2:
>   - incorporated Paul Cercueil's feedback:
>     - changed to pm_sleep_ptr
>     - dropped Fixes: tag
> 
>  drivers/clocksource/ingenic-ost.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/clocksource/ingenic-ost.c 
> b/drivers/clocksource/ingenic-ost.c
> index 06d25754e606..9f7c280a1336 100644
> --- a/drivers/clocksource/ingenic-ost.c
> +++ b/drivers/clocksource/ingenic-ost.c
> @@ -141,7 +141,7 @@ static int __init ingenic_ost_probe(struct 
> platform_device *pdev)
>  	return 0;
>  }
> 
> -static int __maybe_unused ingenic_ost_suspend(struct device *dev)
> +static int ingenic_ost_suspend(struct device *dev)
>  {
>  	struct ingenic_ost *ost = dev_get_drvdata(dev);
> 
> @@ -150,14 +150,14 @@ static int __maybe_unused 
> ingenic_ost_suspend(struct device *dev)
>  	return 0;
>  }
> 
> -static int __maybe_unused ingenic_ost_resume(struct device *dev)
> +static int ingenic_ost_resume(struct device *dev)
>  {
>  	struct ingenic_ost *ost = dev_get_drvdata(dev);
> 
>  	return clk_enable(ost->clk);
>  }
> 
> -static const struct dev_pm_ops __maybe_unused ingenic_ost_pm_ops = {
> +static const struct dev_pm_ops ingenic_ost_pm_ops = {
>  	/* _noirq: We want the OST clock to be gated last / ungated first */
>  	.suspend_noirq = ingenic_ost_suspend,
>  	.resume_noirq  = ingenic_ost_resume,
> @@ -181,9 +181,7 @@ static const struct of_device_id 
> ingenic_ost_of_match[] = {
>  static struct platform_driver ingenic_ost_driver = {
>  	.driver = {
>  		.name = "ingenic-ost",
> -#ifdef CONFIG_PM_SUSPEND
> -		.pm = &ingenic_ost_pm_ops,
> -#endif
> +		.pm = pm_sleep_ptr(&ingenic_ost_pm_ops),
>  		.of_match_table = ingenic_ost_of_match,
>  	},
>  };
> --
> 2.17.1
> 



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

* Re: [PATCH v2] clocksource: ingenic-ost: define pm functions properly in platform_driver struct
  2022-11-23  8:31 [PATCH v2] clocksource: ingenic-ost: define pm functions properly in platform_driver struct Lukas Bulwahn
  2022-11-23 17:54 ` Paul Cercueil
@ 2022-12-01 11:00 ` Thomas Gleixner
  2022-12-01 11:05 ` [tip: timers/core] clocksource/drivers/ingenic-ost: Define " tip-bot2 for Lukas Bulwahn
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2022-12-01 11:00 UTC (permalink / raw)
  To: Lukas Bulwahn, Daniel Lezcano, Paul Cercueil, Maarten ter Huurne
  Cc: kernel-janitors, linux-kernel, Lukas Bulwahn

Lukas!

On Wed, Nov 23 2022 at 09:31, Lukas Bulwahn wrote:
> Commit ca7b72b5a5f2 ("clocksource: Add driver for the Ingenic JZ47xx OST")
> adds the struct platform_driver ingenic_ost_driver, with the definition of
> pm functions under the non-existing config PM_SUSPEND, which means the
> intended pm functions were never actually included in any build.
>
> As the only callbacks are .suspend_noirq and .resume_noirq, we can assume
> that it is intended to be CONFIG_PM_SLEEP.
>
> Since commit 1a3c7bb08826 ("PM: core: Add new *_PM_OPS macros, deprecate
> old ones"), the default pattern for platform_driver definitions
> conditional for CONFIG_PM_SLEEP is to use pm_sleep_ptr().
>
> As __maybe_unused annotations on the dev_pm_ops structure and its callbacks
> are not needed anymore, remove these as well.
>
> Suggested-by: Paul Cercueil <paul@crapouillou.net>
> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>

just a minor nit. The subsystem prefix should be:

     clocksource/drivers/ingenic-ost:

git log --one-line $FILE is usually a good hint for the subsystem
specific prefix choice.

Fixed it up while applying.

Thanks,

        tglx

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

* [tip: timers/core] clocksource/drivers/ingenic-ost: Define pm functions properly in platform_driver struct
  2022-11-23  8:31 [PATCH v2] clocksource: ingenic-ost: define pm functions properly in platform_driver struct Lukas Bulwahn
  2022-11-23 17:54 ` Paul Cercueil
  2022-12-01 11:00 ` Thomas Gleixner
@ 2022-12-01 11:05 ` tip-bot2 for Lukas Bulwahn
  2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Lukas Bulwahn @ 2022-12-01 11:05 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Paul Cercueil, Lukas Bulwahn, Thomas Gleixner, x86, linux-kernel

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

Commit-ID:     035629547999d0e9095886f248c2580dc56f36c6
Gitweb:        https://git.kernel.org/tip/035629547999d0e9095886f248c2580dc56f36c6
Author:        Lukas Bulwahn <lukas.bulwahn@gmail.com>
AuthorDate:    Wed, 23 Nov 2022 09:31:59 +01:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Thu, 01 Dec 2022 11:56:36 +01:00

clocksource/drivers/ingenic-ost: Define pm functions properly in platform_driver struct

Commit ca7b72b5a5f2 ("clocksource: Add driver for the Ingenic JZ47xx OST")
adds the struct platform_driver ingenic_ost_driver, with the definition of
pm functions under the non-existing config PM_SUSPEND, which means the
intended pm functions were never actually included in any build.

As the only callbacks are .suspend_noirq and .resume_noirq, we can assume
that it is intended to be CONFIG_PM_SLEEP.

Since commit 1a3c7bb08826 ("PM: core: Add new *_PM_OPS macros, deprecate
old ones"), the default pattern for platform_driver definitions
conditional for CONFIG_PM_SLEEP is to use pm_sleep_ptr().

As __maybe_unused annotations on the dev_pm_ops structure and its callbacks
are not needed anymore, remove these as well.

Suggested-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20221123083159.22821-1-lukas.bulwahn@gmail.com
---
 drivers/clocksource/ingenic-ost.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/clocksource/ingenic-ost.c b/drivers/clocksource/ingenic-ost.c
index 06d2575..9f7c280 100644
--- a/drivers/clocksource/ingenic-ost.c
+++ b/drivers/clocksource/ingenic-ost.c
@@ -141,7 +141,7 @@ static int __init ingenic_ost_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int __maybe_unused ingenic_ost_suspend(struct device *dev)
+static int ingenic_ost_suspend(struct device *dev)
 {
 	struct ingenic_ost *ost = dev_get_drvdata(dev);
 
@@ -150,14 +150,14 @@ static int __maybe_unused ingenic_ost_suspend(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused ingenic_ost_resume(struct device *dev)
+static int ingenic_ost_resume(struct device *dev)
 {
 	struct ingenic_ost *ost = dev_get_drvdata(dev);
 
 	return clk_enable(ost->clk);
 }
 
-static const struct dev_pm_ops __maybe_unused ingenic_ost_pm_ops = {
+static const struct dev_pm_ops ingenic_ost_pm_ops = {
 	/* _noirq: We want the OST clock to be gated last / ungated first */
 	.suspend_noirq = ingenic_ost_suspend,
 	.resume_noirq  = ingenic_ost_resume,
@@ -181,9 +181,7 @@ static const struct of_device_id ingenic_ost_of_match[] = {
 static struct platform_driver ingenic_ost_driver = {
 	.driver = {
 		.name = "ingenic-ost",
-#ifdef CONFIG_PM_SUSPEND
-		.pm = &ingenic_ost_pm_ops,
-#endif
+		.pm = pm_sleep_ptr(&ingenic_ost_pm_ops),
 		.of_match_table = ingenic_ost_of_match,
 	},
 };

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

end of thread, other threads:[~2022-12-01 11:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-23  8:31 [PATCH v2] clocksource: ingenic-ost: define pm functions properly in platform_driver struct Lukas Bulwahn
2022-11-23 17:54 ` Paul Cercueil
2022-12-01 11:00 ` Thomas Gleixner
2022-12-01 11:05 ` [tip: timers/core] clocksource/drivers/ingenic-ost: Define " tip-bot2 for Lukas Bulwahn

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.