2022-11-14 07:33:28

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: build warnings after merge of the char-misc tree

Hi all,

After merging the char-misc tree, today's linux-next build (powerpc
allnoconfig) produced these warnings:

drivers/bus/simple-pm-bus.c:96:12: warning: 'simple_pm_bus_runtime_resume' defined but not used [-Wunused-function]
96 | static int simple_pm_bus_runtime_resume(struct device *dev)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/bus/simple-pm-bus.c:87:12: warning: 'simple_pm_bus_runtime_suspend' defined but not used [-Wunused-function]
87 | static int simple_pm_bus_runtime_suspend(struct device *dev)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Introduced by commit

882cf4c913d7 ("drivers: bus: simple-pm-bus: Use clocks")

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2022-11-14 07:52:59

by Arnd Bergmann

[permalink] [raw]
Subject: Re: linux-next: build warnings after merge of the char-misc tree

On Mon, Nov 14, 2022, at 08:17, Stephen Rothwell wrote:
> Hi all,
>
> After merging the char-misc tree, today's linux-next build (powerpc
> allnoconfig) produced these warnings:
>
> drivers/bus/simple-pm-bus.c:96:12: warning:
> 'simple_pm_bus_runtime_resume' defined but not used [-Wunused-function]
> 96 | static int simple_pm_bus_runtime_resume(struct device *dev)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/bus/simple-pm-bus.c:87:12: warning:
> 'simple_pm_bus_runtime_suspend' defined but not used [-Wunused-function]
> 87 | static int simple_pm_bus_runtime_suspend(struct device *dev)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Introduced by commit
>
> 882cf4c913d7 ("drivers: bus: simple-pm-bus: Use clocks")

I see that this is caused by the patch using the old-style
SET_RUNTIME_PM_OPS/SET_NOIRQ_SYSTEM_SLEEP_PM_OPS macros
instead of the correct SYSTEM_SLEEP_PM_OPS/NOIRQ_SYSTEM_SLEEP_PM_OPS
versions.

Arnd

2022-11-14 09:46:25

by Liu Ying

[permalink] [raw]
Subject: Re: linux-next: build warnings after merge of the char-misc tree

Hi Arnd,

On Mon, 2022-11-14 at 08:33 +0100, Arnd Bergmann wrote:
> On Mon, Nov 14, 2022, at 08:17, Stephen Rothwell wrote:
> > Hi all,
> >
> > After merging the char-misc tree, today's linux-next build (powerpc
> > allnoconfig) produced these warnings:
> >
> > drivers/bus/simple-pm-bus.c:96:12: warning:
> > 'simple_pm_bus_runtime_resume' defined but not used [-Wunused-function]
> > 96 | static int simple_pm_bus_runtime_resume(struct device *dev)
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > drivers/bus/simple-pm-bus.c:87:12: warning:
> > 'simple_pm_bus_runtime_suspend' defined but not used [-Wunused-function]
> > 87 | static int simple_pm_bus_runtime_suspend(struct device *dev)
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > Introduced by commit
> >
> > 882cf4c913d7 ("drivers: bus: simple-pm-bus: Use clocks")
>
> I see that this is caused by the patch using the old-style
> SET_RUNTIME_PM_OPS/SET_NOIRQ_SYSTEM_SLEEP_PM_OPS macros
> instead of the correct SYSTEM_SLEEP_PM_OPS/NOIRQ_SYSTEM_SLEEP_PM_OPS
> versions.
>

You meant RUNTIME_PM_OPS/NOIRQ_SYSTEM_SLEEP_PM_OPS macros should be
used, right?

Why not add __maybe_unused to the callbacks like below snippet instead?
This way, the old-style macros may determine those callbacks are NULL
or non-NULL according to CONFIG_PM_SLEEP and CONFIG_PM.
-------------------------------8<-------------------------------------
--- a/drivers/bus/simple-pm-bus.c
+++ b/drivers/bus/simple-pm-bus.c
@@ -84,7 +84,7 @@ static int simple_pm_bus_remove(struct
platform_device *pdev)
return 0;
}

-static int simple_pm_bus_runtime_suspend(struct device *dev)
+static int __maybe_unused simple_pm_bus_runtime_suspend(struct device
*dev)
{
struct simple_pm_bus *bus = dev_get_drvdata(dev);

@@ -93,7 +93,7 @@ static int simple_pm_bus_runtime_suspend(struct
device *dev)
return 0;
}

-static int simple_pm_bus_runtime_resume(struct device *dev)
+static int __maybe_unused simple_pm_bus_runtime_resume(struct device
*dev)
{
struct simple_pm_bus *bus = dev_get_drvdata(dev);
int ret;
-------------------------------8<-------------------------------------

Regards,
Liu Ying


2022-11-14 09:50:05

by Greg KH

[permalink] [raw]
Subject: Re: linux-next: build warnings after merge of the char-misc tree

On Mon, Nov 14, 2022 at 08:33:41AM +0100, Arnd Bergmann wrote:
> On Mon, Nov 14, 2022, at 08:17, Stephen Rothwell wrote:
> > Hi all,
> >
> > After merging the char-misc tree, today's linux-next build (powerpc
> > allnoconfig) produced these warnings:
> >
> > drivers/bus/simple-pm-bus.c:96:12: warning:
> > 'simple_pm_bus_runtime_resume' defined but not used [-Wunused-function]
> > 96 | static int simple_pm_bus_runtime_resume(struct device *dev)
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > drivers/bus/simple-pm-bus.c:87:12: warning:
> > 'simple_pm_bus_runtime_suspend' defined but not used [-Wunused-function]
> > 87 | static int simple_pm_bus_runtime_suspend(struct device *dev)
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > Introduced by commit
> >
> > 882cf4c913d7 ("drivers: bus: simple-pm-bus: Use clocks")
>
> I see that this is caused by the patch using the old-style
> SET_RUNTIME_PM_OPS/SET_NOIRQ_SYSTEM_SLEEP_PM_OPS macros
> instead of the correct SYSTEM_SLEEP_PM_OPS/NOIRQ_SYSTEM_SLEEP_PM_OPS
> versions.

Ok, will go revert the offending commit for now, thanks!

greg k-h

2022-11-14 10:15:01

by Arnd Bergmann

[permalink] [raw]
Subject: Re: linux-next: build warnings after merge of the char-misc tree

On Mon, Nov 14, 2022, at 10:03, Liu Ying wrote:
> On Mon, 2022-11-14 at 08:33 +0100, Arnd Bergmann wrote:
>> On Mon, Nov 14, 2022, at 08:17, Stephen Rothwell wrote:
>> > Hi all,
>> >
>> > After merging the char-misc tree, today's linux-next build (powerpc
>> > allnoconfig) produced these warnings:
>> >
>> > drivers/bus/simple-pm-bus.c:96:12: warning:
>> > 'simple_pm_bus_runtime_resume' defined but not used [-Wunused-function]
>> > 96 | static int simple_pm_bus_runtime_resume(struct device *dev)
>> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> > drivers/bus/simple-pm-bus.c:87:12: warning:
>> > 'simple_pm_bus_runtime_suspend' defined but not used [-Wunused-function]
>> > 87 | static int simple_pm_bus_runtime_suspend(struct device *dev)
>> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> >
>> > Introduced by commit
>> >
>> > 882cf4c913d7 ("drivers: bus: simple-pm-bus: Use clocks")
>>
>> I see that this is caused by the patch using the old-style
>> SET_RUNTIME_PM_OPS/SET_NOIRQ_SYSTEM_SLEEP_PM_OPS macros
>> instead of the correct SYSTEM_SLEEP_PM_OPS/NOIRQ_SYSTEM_SLEEP_PM_OPS
>> versions.
>>
>
> You meant RUNTIME_PM_OPS/NOIRQ_SYSTEM_SLEEP_PM_OPS macros should be
> used, right?

Right, sorry for mixing up the runtime ones.

> Why not add __maybe_unused to the callbacks like below snippet instead?
> This way, the old-style macros may determine those callbacks are NULL
> or non-NULL according to CONFIG_PM_SLEEP and CONFIG_PM.

That was the old way of doing it before 1a3c7bb08826 ("PM: core: Add
new *_PM_OPS macros, deprecate old ones"), we are slowly moving to
the new ones instead to avoid having to add __maybe_unused annotations.

You may however want to use ".pm = pm_ptr(&simple_pm_bus_pm_ops)" if
you care about the space savings for configurations with CONFIG_PM
disabled.

Arnd