patches.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc: mediatek: SVS: Use DEFINE_SIMPLE_DEV_PM_OPS for svs_pm_ops
@ 2022-06-22 17:56 Nathan Chancellor
  2022-06-23 12:04 ` Matthias Brugger
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2022-06-22 17:56 UTC (permalink / raw)
  To: Matthias Brugger
  Cc: Roger Lu, linux-arm-kernel, linux-mediatek, patches,
	Nathan Chancellor

When building this driver for an architecture that does not support
CONFIG_PM_SLEEP, such as hexagon, the following warnings occur:

  drivers/soc/mediatek/mtk-svs.c:1481:12: error: unused function 'svs_suspend' [-Werror,-Wunused-function]
  static int svs_suspend(struct device *dev)
             ^
  drivers/soc/mediatek/mtk-svs.c:1515:12: error: unused function 'svs_resume' [-Werror,-Wunused-function]
  static int svs_resume(struct device *dev)
             ^
  2 errors generated.

This happens because SIMPLE_DEV_PM_OPS uses SET_SYSTEM_SLEEP_PM_OPS,
which evaluates to nothing when CONFIG_PM_SLEEP is not set, leaving the
functions unused in the eyes of the compiler.

This problem was rectified in commit 1a3c7bb08826 ("PM: core: Add new
*_PM_OPS macros, deprecate old ones") with new macros. Use
DEFINE_SIMPLE_DEV_PM_OPS to fix the warning while not changing
svs_pm_ops when CONFIG_PM_SLEEP is set.

Fixes: 681a02e95000 ("soc: mediatek: SVS: introduce MTK SVS engine")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 drivers/soc/mediatek/mtk-svs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/mediatek/mtk-svs.c b/drivers/soc/mediatek/mtk-svs.c
index 606a00a2e57d..d70903f45ddf 100644
--- a/drivers/soc/mediatek/mtk-svs.c
+++ b/drivers/soc/mediatek/mtk-svs.c
@@ -2381,7 +2381,7 @@ static int svs_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static SIMPLE_DEV_PM_OPS(svs_pm_ops, svs_suspend, svs_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(svs_pm_ops, svs_suspend, svs_resume);
 
 static struct platform_driver svs_driver = {
 	.probe	= svs_probe,

base-commit: 71eaf1887203d0a59c92fd9dd3436b8d8489d68c
-- 
2.37.0.rc1


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

* Re: [PATCH] soc: mediatek: SVS: Use DEFINE_SIMPLE_DEV_PM_OPS for svs_pm_ops
  2022-06-22 17:56 [PATCH] soc: mediatek: SVS: Use DEFINE_SIMPLE_DEV_PM_OPS for svs_pm_ops Nathan Chancellor
@ 2022-06-23 12:04 ` Matthias Brugger
  2022-07-07  8:25   ` Matthias Brugger
  0 siblings, 1 reply; 3+ messages in thread
From: Matthias Brugger @ 2022-06-23 12:04 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Roger Lu, linux-arm-kernel, linux-mediatek, patches, Jin Xiaoyun



On 22/06/2022 19:56, Nathan Chancellor wrote:
> When building this driver for an architecture that does not support
> CONFIG_PM_SLEEP, such as hexagon, the following warnings occur:
> 
>    drivers/soc/mediatek/mtk-svs.c:1481:12: error: unused function 'svs_suspend' [-Werror,-Wunused-function]
>    static int svs_suspend(struct device *dev)
>               ^
>    drivers/soc/mediatek/mtk-svs.c:1515:12: error: unused function 'svs_resume' [-Werror,-Wunused-function]
>    static int svs_resume(struct device *dev)
>               ^
>    2 errors generated.
> 
> This happens because SIMPLE_DEV_PM_OPS uses SET_SYSTEM_SLEEP_PM_OPS,
> which evaluates to nothing when CONFIG_PM_SLEEP is not set, leaving the
> functions unused in the eyes of the compiler.
> 
> This problem was rectified in commit 1a3c7bb08826 ("PM: core: Add new
> *_PM_OPS macros, deprecate old ones") with new macros. Use
> DEFINE_SIMPLE_DEV_PM_OPS to fix the warning while not changing
> svs_pm_ops when CONFIG_PM_SLEEP is set.
> 
> Fixes: 681a02e95000 ("soc: mediatek: SVS: introduce MTK SVS engine")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Thanks for the patch. The same issue was addressed by Jin Xiayun here:
https://lore.kernel.org/linux-mediatek/20220623030931.2816013-1-jinxiaoyun2@huawei.com/T/#u

I'm happy for any review help.

Regards,
Matthias

> ---
>   drivers/soc/mediatek/mtk-svs.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/mediatek/mtk-svs.c b/drivers/soc/mediatek/mtk-svs.c
> index 606a00a2e57d..d70903f45ddf 100644
> --- a/drivers/soc/mediatek/mtk-svs.c
> +++ b/drivers/soc/mediatek/mtk-svs.c
> @@ -2381,7 +2381,7 @@ static int svs_probe(struct platform_device *pdev)
>   	return ret;
>   }
>   
> -static SIMPLE_DEV_PM_OPS(svs_pm_ops, svs_suspend, svs_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(svs_pm_ops, svs_suspend, svs_resume);
>   
>   static struct platform_driver svs_driver = {
>   	.probe	= svs_probe,
> 
> base-commit: 71eaf1887203d0a59c92fd9dd3436b8d8489d68c

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

* Re: [PATCH] soc: mediatek: SVS: Use DEFINE_SIMPLE_DEV_PM_OPS for svs_pm_ops
  2022-06-23 12:04 ` Matthias Brugger
@ 2022-07-07  8:25   ` Matthias Brugger
  0 siblings, 0 replies; 3+ messages in thread
From: Matthias Brugger @ 2022-07-07  8:25 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Roger Lu, linux-arm-kernel, linux-mediatek, patches, Jin Xiaoyun



On 23/06/2022 14:04, Matthias Brugger wrote:
> 
> 
> On 22/06/2022 19:56, Nathan Chancellor wrote:
>> When building this driver for an architecture that does not support
>> CONFIG_PM_SLEEP, such as hexagon, the following warnings occur:
>>
>>    drivers/soc/mediatek/mtk-svs.c:1481:12: error: unused function 
>> 'svs_suspend' [-Werror,-Wunused-function]
>>    static int svs_suspend(struct device *dev)
>>               ^
>>    drivers/soc/mediatek/mtk-svs.c:1515:12: error: unused function 'svs_resume' 
>> [-Werror,-Wunused-function]
>>    static int svs_resume(struct device *dev)
>>               ^
>>    2 errors generated.
>>
>> This happens because SIMPLE_DEV_PM_OPS uses SET_SYSTEM_SLEEP_PM_OPS,
>> which evaluates to nothing when CONFIG_PM_SLEEP is not set, leaving the
>> functions unused in the eyes of the compiler.
>>
>> This problem was rectified in commit 1a3c7bb08826 ("PM: core: Add new
>> *_PM_OPS macros, deprecate old ones") with new macros. Use
>> DEFINE_SIMPLE_DEV_PM_OPS to fix the warning while not changing
>> svs_pm_ops when CONFIG_PM_SLEEP is set.
>>
>> Fixes: 681a02e95000 ("soc: mediatek: SVS: introduce MTK SVS engine")
>> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> 
> Thanks for the patch. The same issue was addressed by Jin Xiayun here:
> https://lore.kernel.org/linux-mediatek/20220623030931.2816013-1-jinxiaoyun2@huawei.com/T/#u 
> 
> 
> I'm happy for any review help.
> 

As there was no progress on the other patch, I now applied yours.

Thanks!
Matthias

> Regards,
> Matthias
> 
>> ---
>>   drivers/soc/mediatek/mtk-svs.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/soc/mediatek/mtk-svs.c b/drivers/soc/mediatek/mtk-svs.c
>> index 606a00a2e57d..d70903f45ddf 100644
>> --- a/drivers/soc/mediatek/mtk-svs.c
>> +++ b/drivers/soc/mediatek/mtk-svs.c
>> @@ -2381,7 +2381,7 @@ static int svs_probe(struct platform_device *pdev)
>>       return ret;
>>   }
>> -static SIMPLE_DEV_PM_OPS(svs_pm_ops, svs_suspend, svs_resume);
>> +static DEFINE_SIMPLE_DEV_PM_OPS(svs_pm_ops, svs_suspend, svs_resume);
>>   static struct platform_driver svs_driver = {
>>       .probe    = svs_probe,
>>
>> base-commit: 71eaf1887203d0a59c92fd9dd3436b8d8489d68c

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

end of thread, other threads:[~2022-07-07  8:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-22 17:56 [PATCH] soc: mediatek: SVS: Use DEFINE_SIMPLE_DEV_PM_OPS for svs_pm_ops Nathan Chancellor
2022-06-23 12:04 ` Matthias Brugger
2022-07-07  8:25   ` Matthias Brugger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).