linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: musb: mark PM functions as __maybe_unused
@ 2016-11-22 14:30 Arnd Bergmann
  2016-11-23 14:20 ` Tony Lindgren
  2016-11-28 10:51 ` Geert Uytterhoeven
  0 siblings, 2 replies; 5+ messages in thread
From: Arnd Bergmann @ 2016-11-22 14:30 UTC (permalink / raw)
  To: Bin Liu, Greg Kroah-Hartman
  Cc: Arnd Bergmann, Tony Lindgren, Felipe Balbi, Johan Hovold,
	Rasmus Villemoes, linux-usb, linux-kernel

Building without CONFIG_PM causes a harmless warning:

drivers/usb/musb/musb_core.c:2041:12: error: ‘musb_run_resume_work’ defined but not used [-Werror=unused-function]

Removing the #ifdef around the PM code and instead marking the suspend/resume
functions as __maybe_unused will do the right thing without warning.

Fixes: ea2f35c01d5e ("usb: musb: Fix sleeping function called from invalid context for hdrc glue")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/usb/musb/musb_core.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index c3e172e15ec3..cc8192f1f2af 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2485,8 +2485,6 @@ static int musb_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef	CONFIG_PM
-
 static void musb_save_context(struct musb *musb)
 {
 	int i;
@@ -2640,7 +2638,7 @@ static void musb_restore_context(struct musb *musb)
 	musb_writeb(musb_base, MUSB_INDEX, musb->context.index);
 }
 
-static int musb_suspend(struct device *dev)
+static int __maybe_unused musb_suspend(struct device *dev)
 {
 	struct musb	*musb = dev_to_musb(dev);
 	unsigned long	flags;
@@ -2667,7 +2665,7 @@ static int musb_suspend(struct device *dev)
 	return 0;
 }
 
-static int musb_resume(struct device *dev)
+static int __maybe_unused musb_resume(struct device *dev)
 {
 	struct musb *musb = dev_to_musb(dev);
 	unsigned long flags;
@@ -2717,7 +2715,7 @@ static int musb_resume(struct device *dev)
 	return 0;
 }
 
-static int musb_runtime_suspend(struct device *dev)
+static int __maybe_unused musb_runtime_suspend(struct device *dev)
 {
 	struct musb	*musb = dev_to_musb(dev);
 
@@ -2727,7 +2725,7 @@ static int musb_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-static int musb_runtime_resume(struct device *dev)
+static int __maybe_unused musb_runtime_resume(struct device *dev)
 {
 	struct musb *musb = dev_to_musb(dev);
 	unsigned long flags;
@@ -2771,16 +2769,11 @@ static const struct dev_pm_ops musb_dev_pm_ops = {
 	.runtime_resume = musb_runtime_resume,
 };
 
-#define MUSB_DEV_PM_OPS (&musb_dev_pm_ops)
-#else
-#define	MUSB_DEV_PM_OPS	NULL
-#endif
-
 static struct platform_driver musb_driver = {
 	.driver = {
 		.name		= (char *)musb_driver_name,
 		.bus		= &platform_bus_type,
-		.pm		= MUSB_DEV_PM_OPS,
+		.pm		= &musb_dev_pm_ops,
 	},
 	.probe		= musb_probe,
 	.remove		= musb_remove,
-- 
2.9.0

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

* Re: [PATCH] usb: musb: mark PM functions as __maybe_unused
  2016-11-22 14:30 [PATCH] usb: musb: mark PM functions as __maybe_unused Arnd Bergmann
@ 2016-11-23 14:20 ` Tony Lindgren
  2016-11-28 10:51 ` Geert Uytterhoeven
  1 sibling, 0 replies; 5+ messages in thread
From: Tony Lindgren @ 2016-11-23 14:20 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Bin Liu, Greg Kroah-Hartman, Felipe Balbi, Johan Hovold,
	Rasmus Villemoes, linux-usb, linux-kernel

* Arnd Bergmann <arnd@arndb.de> [161122 06:30]:
> Building without CONFIG_PM causes a harmless warning:
> 
> drivers/usb/musb/musb_core.c:2041:12: error: ‘musb_run_resume_work’ defined but not used [-Werror=unused-function]
> 
> Removing the #ifdef around the PM code and instead marking the suspend/resume
> functions as __maybe_unused will do the right thing without warning.

OK works for me:

Acked-by: Tony Lindgren <tony@atomide.com>

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

* Re: [PATCH] usb: musb: mark PM functions as __maybe_unused
  2016-11-22 14:30 [PATCH] usb: musb: mark PM functions as __maybe_unused Arnd Bergmann
  2016-11-23 14:20 ` Tony Lindgren
@ 2016-11-28 10:51 ` Geert Uytterhoeven
  2016-11-28 10:54   ` Arnd Bergmann
  1 sibling, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2016-11-28 10:51 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Bin Liu, Greg Kroah-Hartman, Tony Lindgren, Felipe Balbi,
	Johan Hovold, Rasmus Villemoes, USB list, linux-kernel

On Tue, Nov 22, 2016 at 3:30 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> Building without CONFIG_PM causes a harmless warning:
>
> drivers/usb/musb/musb_core.c:2041:12: error: ‘musb_run_resume_work’ defined but not used [-Werror=unused-function]
>
> Removing the #ifdef around the PM code and instead marking the suspend/resume
> functions as __maybe_unused will do the right thing without warning.
>
> Fixes: ea2f35c01d5e ("usb: musb: Fix sleeping function called from invalid context for hdrc glue")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

linux-m68k-allmodconfig$ bloat-o-meter drivers/usb/musb/musb_core.o{.orig,}
add/remove: 8/0 grow/shrink: 0/0 up/down: 2344/0 (2344)
function                                     old     new   delta
musb_restore_context                           -     892    +892
musb_save_context                              -     690    +690
musb_run_resume_work                           -     190    +190
musb_resume                                    -     182    +182
musb_runtime_resume                            -     148    +148
musb_suspend                                   -     114    +114
musb_dev_pm_ops                                -      92     +92
musb_runtime_suspend                           -      36     +36
Total: Before=13091, After=15435, chg +17.91%

Doh...

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] usb: musb: mark PM functions as __maybe_unused
  2016-11-28 10:51 ` Geert Uytterhoeven
@ 2016-11-28 10:54   ` Arnd Bergmann
  2016-11-28 11:09     ` Geert Uytterhoeven
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2016-11-28 10:54 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Bin Liu, Greg Kroah-Hartman, Tony Lindgren, Felipe Balbi,
	Johan Hovold, Rasmus Villemoes, USB list, linux-kernel

On Monday, November 28, 2016 11:51:37 AM CET Geert Uytterhoeven wrote:
> On Tue, Nov 22, 2016 at 3:30 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > Building without CONFIG_PM causes a harmless warning:
> >
> > drivers/usb/musb/musb_core.c:2041:12: error: ‘musb_run_resume_work’ defined but not used [-Werror=unused-function]
> >
> > Removing the #ifdef around the PM code and instead marking the suspend/resume
> > functions as __maybe_unused will do the right thing without warning.
> >
> > Fixes: ea2f35c01d5e ("usb: musb: Fix sleeping function called from invalid context for hdrc glue")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> linux-m68k-allmodconfig$ bloat-o-meter drivers/usb/musb/musb_core.o{.orig,}
> add/remove: 8/0 grow/shrink: 0/0 up/down: 2344/0 (2344)
> function                                     old     new   delta
> musb_restore_context                           -     892    +892
> musb_save_context                              -     690    +690
> musb_run_resume_work                           -     190    +190
> musb_resume                                    -     182    +182
> musb_runtime_resume                            -     148    +148
> musb_suspend                                   -     114    +114
> musb_dev_pm_ops                                -      92     +92
> musb_runtime_suspend                           -      36     +36
> Total: Before=13091, After=15435, chg +17.91%

Well, in allmodconfig, you have CONFIG_PM enabled, so this is not
dead code but actually does what was intended (though possibly
not written as efficiently as it could have been).

In a configuration without CONFIG_PM, there should ideally be
no added code.

	Arnd

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

* Re: [PATCH] usb: musb: mark PM functions as __maybe_unused
  2016-11-28 10:54   ` Arnd Bergmann
@ 2016-11-28 11:09     ` Geert Uytterhoeven
  0 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2016-11-28 11:09 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Bin Liu, Greg Kroah-Hartman, Tony Lindgren, Felipe Balbi,
	Johan Hovold, Rasmus Villemoes, USB list, linux-kernel

Hi Arnd,

On Mon, Nov 28, 2016 at 11:54 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Monday, November 28, 2016 11:51:37 AM CET Geert Uytterhoeven wrote:
>> On Tue, Nov 22, 2016 at 3:30 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>> > Building without CONFIG_PM causes a harmless warning:
>> >
>> > drivers/usb/musb/musb_core.c:2041:12: error: ‘musb_run_resume_work’ defined but not used [-Werror=unused-function]
>> >
>> > Removing the #ifdef around the PM code and instead marking the suspend/resume
>> > functions as __maybe_unused will do the right thing without warning.
>> >
>> > Fixes: ea2f35c01d5e ("usb: musb: Fix sleeping function called from invalid context for hdrc glue")
>> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>
>> linux-m68k-allmodconfig$ bloat-o-meter drivers/usb/musb/musb_core.o{.orig,}
>> add/remove: 8/0 grow/shrink: 0/0 up/down: 2344/0 (2344)
>> function                                     old     new   delta
>> musb_restore_context                           -     892    +892
>> musb_save_context                              -     690    +690
>> musb_run_resume_work                           -     190    +190
>> musb_resume                                    -     182    +182
>> musb_runtime_resume                            -     148    +148
>> musb_suspend                                   -     114    +114
>> musb_dev_pm_ops                                -      92     +92
>> musb_runtime_suspend                           -      36     +36
>> Total: Before=13091, After=15435, chg +17.91%
>
> Well, in allmodconfig, you have CONFIG_PM enabled, so this is not
> dead code but actually does what was intended (though possibly
> not written as efficiently as it could have been).

M68k does not have CONFIG_PM.

> In a configuration without CONFIG_PM, there should ideally be
> no added code.

Apparently not :-(

BTW, same result for allyesconfig.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2016-11-28 11:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-22 14:30 [PATCH] usb: musb: mark PM functions as __maybe_unused Arnd Bergmann
2016-11-23 14:20 ` Tony Lindgren
2016-11-28 10:51 ` Geert Uytterhoeven
2016-11-28 10:54   ` Arnd Bergmann
2016-11-28 11:09     ` Geert Uytterhoeven

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