[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e5c0719a-d49f-4470-964a-c72973c975e7@foss.st.com>
Date: Tue, 25 Jun 2024 08:17:38 +0200
From: Patrice CHOTARD <patrice.chotard@...s.st.com>
To: Raphael Gallais-Pou <rgallaispou@...il.com>,
"Rafael J. Wysocki"
<rafael@...nel.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Zhang Rui
<rui.zhang@...el.com>, Lukasz Luba <lukasz.luba@....com>,
Maxime Coquelin
<mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>
CC: <linux-pm@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-stm32@...md-mailman.stormreply.com>,
<linux-arm-kernel@...ts.infradead.org>, <devicetree@...r.kernel.org>
Subject: Re: [PATCH 1/3] thermal: st: switch from CONFIG_PM_SLEEP guards to
pm_sleep_ptr()
On 5/18/24 14:12, Raphael Gallais-Pou wrote:
> Letting the compiler remove these functions when the kernel is built
> without CONFIG_PM_SLEEP support is simpler and less error prone than the
> use of #ifdef based kernel configuration guards.
>
> Remove those guards on every ST thermal related drivers.
>
> Signed-off-by: Raphael Gallais-Pou <rgallaispou@...il.com>
> ---
> drivers/thermal/st/st_thermal.c | 4 +---
> drivers/thermal/st/st_thermal_memmap.c | 2 +-
> drivers/thermal/st/stm_thermal.c | 8 +++-----
> 3 files changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c
> index 2a105409864e..5f33543a3a54 100644
> --- a/drivers/thermal/st/st_thermal.c
> +++ b/drivers/thermal/st/st_thermal.c
> @@ -236,7 +236,6 @@ void st_thermal_unregister(struct platform_device *pdev)
> }
> EXPORT_SYMBOL_GPL(st_thermal_unregister);
>
> -#ifdef CONFIG_PM_SLEEP
> static int st_thermal_suspend(struct device *dev)
> {
> struct st_thermal_sensor *sensor = dev_get_drvdata(dev);
> @@ -265,9 +264,8 @@ static int st_thermal_resume(struct device *dev)
>
> return 0;
> }
> -#endif
>
> -SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume);
> +DEFINE_SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume);
> EXPORT_SYMBOL_GPL(st_thermal_pm_ops);
>
> MODULE_AUTHOR("STMicroelectronics (R&D) Limited <ajitpal.singh@...com>");
> diff --git a/drivers/thermal/st/st_thermal_memmap.c b/drivers/thermal/st/st_thermal_memmap.c
> index 29c2269b0fb3..28b380013956 100644
> --- a/drivers/thermal/st/st_thermal_memmap.c
> +++ b/drivers/thermal/st/st_thermal_memmap.c
> @@ -180,7 +180,7 @@ static void st_mmap_remove(struct platform_device *pdev)
> static struct platform_driver st_mmap_thermal_driver = {
> .driver = {
> .name = "st_thermal_mmap",
> - .pm = &st_thermal_pm_ops,
> + .pm = pm_sleep_ptr(&st_thermal_pm_ops),
> .of_match_table = st_mmap_thermal_of_match,
> },
> .probe = st_mmap_probe,
> diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c
> index 34785b9276fc..ffd988600ed6 100644
> --- a/drivers/thermal/st/stm_thermal.c
> +++ b/drivers/thermal/st/stm_thermal.c
> @@ -440,7 +440,6 @@ static int stm_thermal_prepare(struct stm_thermal_sensor *sensor)
> return ret;
> }
>
> -#ifdef CONFIG_PM_SLEEP
> static int stm_thermal_suspend(struct device *dev)
> {
> struct stm_thermal_sensor *sensor = dev_get_drvdata(dev);
> @@ -466,10 +465,9 @@ static int stm_thermal_resume(struct device *dev)
>
> return 0;
> }
> -#endif /* CONFIG_PM_SLEEP */
>
> -static SIMPLE_DEV_PM_OPS(stm_thermal_pm_ops,
> - stm_thermal_suspend, stm_thermal_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(stm_thermal_pm_ops,
> + stm_thermal_suspend, stm_thermal_resume);
>
> static const struct thermal_zone_device_ops stm_tz_ops = {
> .get_temp = stm_thermal_get_temp,
> @@ -580,7 +578,7 @@ static void stm_thermal_remove(struct platform_device *pdev)
> static struct platform_driver stm_thermal_driver = {
> .driver = {
> .name = "stm_thermal",
> - .pm = &stm_thermal_pm_ops,
> + .pm = pm_sleep_ptr(&stm_thermal_pm_ops),
> .of_match_table = stm_thermal_of_match,
> },
> .probe = stm_thermal_probe,
>
Hi Raphael
Reviewed-by: Patrice Chotard <patrice.chotard@...s.st.com>
Thanks
Patrice
Powered by blists - more mailing lists