linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -mm] ALSA portman2x4 section mismatch
@ 2007-06-26 22:30 Randy Dunlap
  2007-06-27 10:02 ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Randy Dunlap @ 2007-06-26 22:30 UTC (permalink / raw)
  To: lkml; +Cc: akpm, perex

From: Randy Dunlap <randy.dunlap@oracle.com>

FIx section mismatch when CONFIG_HOTPLUG=n:

WARNING: sound/built-in.o(.exit.text+0x271): Section mismatch: reference to .init.text:snd_p
ortman_unregister_all (between 'snd_portman_module_exit' and 'alsa_mpu401_uart_exit')

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
 sound/drivers/portman2x4.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.22-rc4-mm2.orig/sound/drivers/portman2x4.c
+++ linux-2.6.22-rc4-mm2/sound/drivers/portman2x4.c
@@ -833,7 +833,7 @@ static struct platform_driver snd_portma
 /*********************************************************************
  * module init stuff
  *********************************************************************/
-static void __init_or_module snd_portman_unregister_all(void)
+static void snd_portman_unregister_all(void)
 {
 	int i;
 

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

* Re: [PATCH -mm] ALSA portman2x4 section mismatch
  2007-06-26 22:30 [PATCH -mm] ALSA portman2x4 section mismatch Randy Dunlap
@ 2007-06-27 10:02 ` Takashi Iwai
  2007-06-28 17:24   ` Randy Dunlap
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2007-06-27 10:02 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: lkml, akpm, perex

At Tue, 26 Jun 2007 15:30:13 -0700,
Randy Dunlap wrote:
> 
> From: Randy Dunlap <randy.dunlap@oracle.com>
> 
> FIx section mismatch when CONFIG_HOTPLUG=n:
> 
> WARNING: sound/built-in.o(.exit.text+0x271): Section mismatch: reference to .init.text:snd_p
> ortman_unregister_all (between 'snd_portman_module_exit' and 'alsa_mpu401_uart_exit')
> 
> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>

I applied it to ALSA tree now because it's the simplest way to fix
this warning.  But, I'm still wondering whether it was really wrong.

The function snd_portmap_unregister_all() is called both from the
module init and exit functions.  Would the module_exit function be
called even CONFIG_MODULE=n ?  If not, __init_or_module should be
correct since the function is called only from module_init.


thanks,

Takashi


> ---
>  sound/drivers/portman2x4.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- linux-2.6.22-rc4-mm2.orig/sound/drivers/portman2x4.c
> +++ linux-2.6.22-rc4-mm2/sound/drivers/portman2x4.c
> @@ -833,7 +833,7 @@ static struct platform_driver snd_portma
>  /*********************************************************************
>   * module init stuff
>   *********************************************************************/
> -static void __init_or_module snd_portman_unregister_all(void)
> +static void snd_portman_unregister_all(void)
>  {
>  	int i;
>  
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

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

* Re: [PATCH -mm] ALSA portman2x4 section mismatch
  2007-06-27 10:02 ` Takashi Iwai
@ 2007-06-28 17:24   ` Randy Dunlap
  2007-06-28 18:15     ` Sam Ravnborg
  0 siblings, 1 reply; 4+ messages in thread
From: Randy Dunlap @ 2007-06-28 17:24 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: lkml, akpm, perex, sam

On Wed, 27 Jun 2007 12:02:32 +0200 Takashi Iwai wrote:

> At Tue, 26 Jun 2007 15:30:13 -0700,
> Randy Dunlap wrote:
> > 
> > From: Randy Dunlap <randy.dunlap@oracle.com>
> > 
> > FIx section mismatch when CONFIG_HOTPLUG=n:
> > 
> > WARNING: sound/built-in.o(.exit.text+0x271): Section mismatch: reference to .init.text:snd_p
> > ortman_unregister_all (between 'snd_portman_module_exit' and 'alsa_mpu401_uart_exit')
> > 
> > Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
> 
> I applied it to ALSA tree now because it's the simplest way to fix
> this warning.  But, I'm still wondering whether it was really wrong.
> 
> The function snd_portmap_unregister_all() is called both from the
> module init and exit functions.  Would the module_exit function be
> called even CONFIG_MODULE=n ?

No, it's not called when the driver is built-in.

> If not, __init_or_module should be
> correct since the function is called only from module_init.

[adding Sam to cc:]

I see.  So to try to summarize:

When CONFIG_MODULES=n, __exit functions can be allowed to reference
__init functions since the __init functions won't be called because
the __exit functions are not invoked.

Does that sound correct?  Can & should modpost add this knowledge?

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

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

* Re: [PATCH -mm] ALSA portman2x4 section mismatch
  2007-06-28 17:24   ` Randy Dunlap
@ 2007-06-28 18:15     ` Sam Ravnborg
  0 siblings, 0 replies; 4+ messages in thread
From: Sam Ravnborg @ 2007-06-28 18:15 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Takashi Iwai, lkml, akpm, perex

On Thu, Jun 28, 2007 at 10:24:38AM -0700, Randy Dunlap wrote:
> On Wed, 27 Jun 2007 12:02:32 +0200 Takashi Iwai wrote:
> 
> > At Tue, 26 Jun 2007 15:30:13 -0700,
> > Randy Dunlap wrote:
> > > 
> > > From: Randy Dunlap <randy.dunlap@oracle.com>
> > > 
> > > FIx section mismatch when CONFIG_HOTPLUG=n:
> > > 
> > > WARNING: sound/built-in.o(.exit.text+0x271): Section mismatch: reference to .init.text:snd_p
> > > ortman_unregister_all (between 'snd_portman_module_exit' and 'alsa_mpu401_uart_exit')
> > > 
> > > Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
> > 
> > I applied it to ALSA tree now because it's the simplest way to fix
> > this warning.  But, I'm still wondering whether it was really wrong.
> > 
> > The function snd_portmap_unregister_all() is called both from the
> > module init and exit functions.  Would the module_exit function be
> > called even CONFIG_MODULE=n ?
> 
> No, it's not called when the driver is built-in.
> 
> > If not, __init_or_module should be
> > correct since the function is called only from module_init.
> 
> [adding Sam to cc:]
> 
> I see.  So to try to summarize:
> 
> When CONFIG_MODULES=n, __exit functions can be allowed to reference
> __init functions since the __init functions won't be called because
> the __exit functions are not invoked.
> 
> Does that sound correct?
In the CONFIG_MODULES=n case the __exit section is discarded so yes they
can reference anything without causing breakage.
But that said this is by no means a logical thing to allow from the principle
of minimum suprise.

>  Can & should modpost add this knowledge?
So modpost should not have this knowledge. A better approach is either to fix
the relations or drom the __init/__exit marker for a few sections.
The __init/__exit parts are mainly of benefit in two cases:
1) When someone has a lot of built-in drivers
2) In the embedded world with scarce memory

As for 1) this is a non-typical case not worth optimizing too much against.
As for 2) this is where the biggest benefit are.

Considering this alsa drivers are likely not typical embedded so here dropping a few
__init/__exit markings should be safe.
But it also depends on what other code is invoked from these functions.

	Sam

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

end of thread, other threads:[~2007-06-28 18:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-26 22:30 [PATCH -mm] ALSA portman2x4 section mismatch Randy Dunlap
2007-06-27 10:02 ` Takashi Iwai
2007-06-28 17:24   ` Randy Dunlap
2007-06-28 18:15     ` Sam Ravnborg

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