public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: multi: Mark {cdc,rndis}_config_register() __init
@ 2013-04-24 11:16 Geert Uytterhoeven
  2013-04-24 17:05 ` Michal Nazarewicz
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2013-04-24 11:16 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman
  Cc: linux-usb, linux-kernel, Geert Uytterhoeven

If gcc (e.g. 4.1.2) decides not to inline cdc_config_register() and
rndis_config_register(), this will cause section mismatch warnings:

WARNING: drivers/usb/gadget/g_multi.o(.text+0x32f6): Section mismatch in reference from the function cdc_config_register() to the function .init.text:cdc_do_config()
The function cdc_config_register() references
the function __init cdc_do_config().
This is often because cdc_config_register lacks a __init
annotation or the annotation of cdc_do_config is wrong.

WARNING: drivers/usb/gadget/g_multi.o(.text+0x3326): Section mismatch in reference from the function rndis_config_register() to the function .init.text:rndis_do_config()
The function rndis_config_register() references
the function __init rndis_do_config().
This is often because rndis_config_register lacks a __init
annotation or the annotation of rndis_do_config is wrong.

Fortunately they're harmless, as {cdc,rndis}_config_register() are only
called from multi_bind(), which is annotated with __ref.

Mark {cdc,rndis}_config_register() with the __init annotation to kill the
warning.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
Note: I did not verify that multi_bind() is rightfully marked __ref.

 drivers/usb/gadget/multi.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c
index 20bbbf9..db63d9e 100644
--- a/drivers/usb/gadget/multi.c
+++ b/drivers/usb/gadget/multi.c
@@ -177,7 +177,7 @@ err_func_acm:
 	return ret;
 }
 
-static int rndis_config_register(struct usb_composite_dev *cdev)
+static __init int rndis_config_register(struct usb_composite_dev *cdev)
 {
 	static struct usb_configuration config = {
 		.bConfigurationValue	= MULTI_RNDIS_CONFIG_NUM,
@@ -192,7 +192,7 @@ static int rndis_config_register(struct usb_composite_dev *cdev)
 
 #else
 
-static int rndis_config_register(struct usb_composite_dev *cdev)
+static __init int rndis_config_register(struct usb_composite_dev *cdev)
 {
 	return 0;
 }
@@ -240,7 +240,7 @@ err_func_acm:
 	return ret;
 }
 
-static int cdc_config_register(struct usb_composite_dev *cdev)
+static __init int cdc_config_register(struct usb_composite_dev *cdev)
 {
 	static struct usb_configuration config = {
 		.bConfigurationValue	= MULTI_CDC_CONFIG_NUM,
@@ -255,7 +255,7 @@ static int cdc_config_register(struct usb_composite_dev *cdev)
 
 #else
 
-static int cdc_config_register(struct usb_composite_dev *cdev)
+static __init int cdc_config_register(struct usb_composite_dev *cdev)
 {
 	return 0;
 }
-- 
1.7.0.4


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

* Re: [PATCH] usb: gadget: multi: Mark {cdc,rndis}_config_register() __init
  2013-04-24 11:16 [PATCH] usb: gadget: multi: Mark {cdc,rndis}_config_register() __init Geert Uytterhoeven
@ 2013-04-24 17:05 ` Michal Nazarewicz
  2013-04-25  9:07   ` Felipe Balbi
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Nazarewicz @ 2013-04-24 17:05 UTC (permalink / raw)
  To: Geert Uytterhoeven, Felipe Balbi, Greg Kroah-Hartman
  Cc: linux-usb, linux-kernel, Geert Uytterhoeven

[-- Attachment #1: Type: text/plain, Size: 2111 bytes --]

On Wed, Apr 24 2013, Geert Uytterhoeven wrote:
> If gcc (e.g. 4.1.2) decides not to inline cdc_config_register() and
> rndis_config_register(), this will cause section mismatch warnings:
>
> WARNING: drivers/usb/gadget/g_multi.o(.text+0x32f6): Section mismatch in reference from the function cdc_config_register() to the function .init.text:cdc_do_config()
> The function cdc_config_register() references
> the function __init cdc_do_config().
> This is often because cdc_config_register lacks a __init
> annotation or the annotation of cdc_do_config is wrong.
>
> WARNING: drivers/usb/gadget/g_multi.o(.text+0x3326): Section mismatch in reference from the function rndis_config_register() to the function .init.text:rndis_do_config()
> The function rndis_config_register() references
> the function __init rndis_do_config().
> This is often because rndis_config_register lacks a __init
> annotation or the annotation of rndis_do_config is wrong.
>
> Fortunately they're harmless, as {cdc,rndis}_config_register() are only
> called from multi_bind(), which is annotated with __ref.
>
> Mark {cdc,rndis}_config_register() with the __init annotation to kill the
> warning.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Acked-by: Michal Nazarewicz <mina86@mina86.com>

With transition to configfs all those __inits and __refs will probably
go away in the long term though.

> ---
> Note: I did not verify that multi_bind() is rightfully marked __ref.

It should be.  It's only referenced in multi_driver object as a bind
callback which is called by composite_bind() which is referenced in
composite_driver_template as bind callback which is called by
usb_gadget_probe_driver() which is called by usb_composite_probe() which
is called by multi_init() which is __init and called as module_init.

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +----<email/xmpp: mpn@google.com>--------------ooO--(_)--Ooo--

[-- Attachment #2.1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2.2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: [PATCH] usb: gadget: multi: Mark {cdc,rndis}_config_register() __init
  2013-04-24 17:05 ` Michal Nazarewicz
@ 2013-04-25  9:07   ` Felipe Balbi
  0 siblings, 0 replies; 3+ messages in thread
From: Felipe Balbi @ 2013-04-25  9:07 UTC (permalink / raw)
  To: Michal Nazarewicz
  Cc: Geert Uytterhoeven, Felipe Balbi, Greg Kroah-Hartman, linux-usb,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1628 bytes --]

On Wed, Apr 24, 2013 at 10:05:46AM -0700, Michal Nazarewicz wrote:
> On Wed, Apr 24 2013, Geert Uytterhoeven wrote:
> > If gcc (e.g. 4.1.2) decides not to inline cdc_config_register() and
> > rndis_config_register(), this will cause section mismatch warnings:
> >
> > WARNING: drivers/usb/gadget/g_multi.o(.text+0x32f6): Section mismatch in reference from the function cdc_config_register() to the function .init.text:cdc_do_config()
> > The function cdc_config_register() references
> > the function __init cdc_do_config().
> > This is often because cdc_config_register lacks a __init
> > annotation or the annotation of cdc_do_config is wrong.
> >
> > WARNING: drivers/usb/gadget/g_multi.o(.text+0x3326): Section mismatch in reference from the function rndis_config_register() to the function .init.text:rndis_do_config()
> > The function rndis_config_register() references
> > the function __init rndis_do_config().
> > This is often because rndis_config_register lacks a __init
> > annotation or the annotation of rndis_do_config is wrong.
> >
> > Fortunately they're harmless, as {cdc,rndis}_config_register() are only
> > called from multi_bind(), which is annotated with __ref.
> >
> > Mark {cdc,rndis}_config_register() with the __init annotation to kill the
> > warning.
> >
> > Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> 
> Acked-by: Michal Nazarewicz <mina86@mina86.com>
> 
> With transition to configfs all those __inits and __refs will probably
> go away in the long term though.

that's what I thought. Wouldn't it be better to remove them all already?

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2013-04-25  9:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-24 11:16 [PATCH] usb: gadget: multi: Mark {cdc,rndis}_config_register() __init Geert Uytterhoeven
2013-04-24 17:05 ` Michal Nazarewicz
2013-04-25  9:07   ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox