All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hostap: fix section mismatch warning
@ 2007-10-29 18:20 Randy Dunlap
  2007-10-29 20:52 ` John W. Linville
  0 siblings, 1 reply; 4+ messages in thread
From: Randy Dunlap @ 2007-10-29 18:20 UTC (permalink / raw)
  To: linux-wireless; +Cc: j, akpm

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

Fix section mismatch warning:

WARNING: vmlinux.o(.data+0x36fcc): Section mismatch: reference to .init.data:prism2_pci_id_table (between 'prism2_pci_drv_id' and 'prism2_pci_funcs')

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
 drivers/net/wireless/hostap/hostap_pci.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- linux-2624-rc1g4-v1.orig/drivers/net/wireless/hostap/hostap_pci.c
+++ linux-2624-rc1g4-v1/drivers/net/wireless/hostap/hostap_pci.c
@@ -444,7 +444,7 @@ static int prism2_pci_resume(struct pci_
 
 MODULE_DEVICE_TABLE(pci, prism2_pci_id_table);
 
-static struct pci_driver prism2_pci_drv_id = {
+static struct pci_driver prism2_pci_driver = {
 	.name		= "hostap_pci",
 	.id_table	= prism2_pci_id_table,
 	.probe		= prism2_pci_probe,
@@ -458,13 +458,13 @@ static struct pci_driver prism2_pci_drv_
 
 static int __init init_prism2_pci(void)
 {
-	return pci_register_driver(&prism2_pci_drv_id);
+	return pci_register_driver(&prism2_pci_driver);
 }
 
 
 static void __exit exit_prism2_pci(void)
 {
-	pci_unregister_driver(&prism2_pci_drv_id);
+	pci_unregister_driver(&prism2_pci_driver);
 }
 
 

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

* Re: [PATCH] hostap: fix section mismatch warning
  2007-10-29 18:20 [PATCH] hostap: fix section mismatch warning Randy Dunlap
@ 2007-10-29 20:52 ` John W. Linville
  2007-10-29 20:58   ` Randy Dunlap
  0 siblings, 1 reply; 4+ messages in thread
From: John W. Linville @ 2007-10-29 20:52 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: linux-wireless, j, akpm

On Mon, Oct 29, 2007 at 11:20:26AM -0700, Randy Dunlap wrote:
> From: Randy Dunlap <randy.dunlap@oracle.com>
> 
> Fix section mismatch warning:
> 
> WARNING: vmlinux.o(.data+0x36fcc): Section mismatch: reference to .init.data:prism2_pci_id_table (between 'prism2_pci_drv_id' and 'prism2_pci_funcs')
> 
> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
> ---
>  drivers/net/wireless/hostap/hostap_pci.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> --- linux-2624-rc1g4-v1.orig/drivers/net/wireless/hostap/hostap_pci.c
> +++ linux-2624-rc1g4-v1/drivers/net/wireless/hostap/hostap_pci.c
> @@ -444,7 +444,7 @@ static int prism2_pci_resume(struct pci_
>  
>  MODULE_DEVICE_TABLE(pci, prism2_pci_id_table);
>  
> -static struct pci_driver prism2_pci_drv_id = {
> +static struct pci_driver prism2_pci_driver = {
>  	.name		= "hostap_pci",
>  	.id_table	= prism2_pci_id_table,
>  	.probe		= prism2_pci_probe,

Randy,

Would you mind explaining how changing the name of the pci_driver
variable resolves this?  There must be some magic here...

Thanks!

John
-- 
John W. Linville
linville@tuxdriver.com

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

* Re: [PATCH] hostap: fix section mismatch warning
  2007-10-29 20:52 ` John W. Linville
@ 2007-10-29 20:58   ` Randy Dunlap
  2007-10-29 21:06     ` John W. Linville
  0 siblings, 1 reply; 4+ messages in thread
From: Randy Dunlap @ 2007-10-29 20:58 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless, j, akpm

John W. Linville wrote:
> On Mon, Oct 29, 2007 at 11:20:26AM -0700, Randy Dunlap wrote:
>> From: Randy Dunlap <randy.dunlap@oracle.com>
>>
>> Fix section mismatch warning:
>>
>> WARNING: vmlinux.o(.data+0x36fcc): Section mismatch: reference to .init.data:prism2_pci_id_table (between 'prism2_pci_drv_id' and 'prism2_pci_funcs')
>>
>> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
>> ---
>>  drivers/net/wireless/hostap/hostap_pci.c |    6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> --- linux-2624-rc1g4-v1.orig/drivers/net/wireless/hostap/hostap_pci.c
>> +++ linux-2624-rc1g4-v1/drivers/net/wireless/hostap/hostap_pci.c
>> @@ -444,7 +444,7 @@ static int prism2_pci_resume(struct pci_
>>  
>>  MODULE_DEVICE_TABLE(pci, prism2_pci_id_table);
>>  
>> -static struct pci_driver prism2_pci_drv_id = {
>> +static struct pci_driver prism2_pci_driver = {
>>  	.name		= "hostap_pci",
>>  	.id_table	= prism2_pci_id_table,
>>  	.probe		= prism2_pci_probe,
> 
> Randy,
> 
> Would you mind explaining how changing the name of the pci_driver
> variable resolves this?  There must be some magic here...

Oh, sure.  In scripts/mod/modpost.c, there is a whitelist of variable
name suffixes.  Those suffixes are assumed to be safe for referring
to non-text code/data.  OTOH, if someone complains enough, another
whitelist table element can also be added...


/**
 * Whitelist to allow certain references to pass with no warning.
 *
 * Pattern 0:
 *   Do not warn if funtion/data are marked with __init_refok/__initdata_refok.
 *   The pattern is identified by:
 *   fromsec = .text.init.refok* | .data.init.refok*
 *
 * Pattern 1:
 *   If a module parameter is declared __initdata and permissions=0
 *   then this is legal despite the warning generated.
 *   We cannot see value of permissions here, so just ignore
 *   this pattern.
 *   The pattern is identified by:
 *   tosec   = .init.data
 *   fromsec = .data*
 *   atsym   =__param*
 *
 * Pattern 2:
 *   Many drivers utilise a *driver container with references to
 *   add, remove, probe functions etc.
 *   These functions may often be marked __init and we do not want to
 *   warn here.
 *   the pattern is identified by:
 *   tosec   = init or exit section
 *   fromsec = data section
 *   atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one, *_console, *_timer
 *
 * Pattern 3:
 *   Whitelist all refereces from .text.head to .init.data
 *   Whitelist all refereces from .text.head to .init.text
 *
 * Pattern 4:
 *   Some symbols belong to init section but still it is ok to reference
 *   these from non-init sections as these symbols don't have any memory
 *   allocated for them and symbol address and value are same. So even
 *   if init section is freed, its ok to reference those symbols.
 *   For ex. symbols marking the init section boundaries.
 *   This pattern is identified by
 *   refsymname = __init_begin, _sinittext, _einittext
 *
 * Pattern 5:
 *   Xtensa uses literal sections for constants that are accessed PC-relative.
 *   Literal sections may safely reference their text sections.
 *   (Note that the name for the literal section omits any trailing '.text')
 *   tosec = <section>[.text]
 *   fromsec = <section>.literal
 **/
static int secref_whitelist(const char *modname, const char *tosec,
			    const char *fromsec, const char *atsym,
			    const char *refsymname)
{
	int len;
	const char **s;
	const char *pat2sym[] = {
		"driver",
		"_template", /* scsi uses *_template a lot */
		"_timer",    /* arm uses ops structures named _timer a lot */
		"_sht",      /* scsi also used *_sht to some extent */
		"_ops",
		"_probe",
		"_probe_one",
		"_console",
		NULL
	};

	const char *pat3refsym[] = {
		"__init_begin",
		"_sinittext",
		"_einittext",
		NULL
	};

-- 
~Randy

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

* Re: [PATCH] hostap: fix section mismatch warning
  2007-10-29 20:58   ` Randy Dunlap
@ 2007-10-29 21:06     ` John W. Linville
  0 siblings, 0 replies; 4+ messages in thread
From: John W. Linville @ 2007-10-29 21:06 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: linux-wireless, j, akpm

On Mon, Oct 29, 2007 at 01:58:39PM -0700, Randy Dunlap wrote:

> >Would you mind explaining how changing the name of the pci_driver
> >variable resolves this?  There must be some magic here...
> 
> Oh, sure.  In scripts/mod/modpost.c, there is a whitelist of variable
> name suffixes.  Those suffixes are assumed to be safe for referring
> to non-text code/data.  OTOH, if someone complains enough, another
> whitelist table element can also be added...

Ah, got it.  Thanks!

John
-- 
John W. Linville
linville@tuxdriver.com

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

end of thread, other threads:[~2007-10-29 21:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-29 18:20 [PATCH] hostap: fix section mismatch warning Randy Dunlap
2007-10-29 20:52 ` John W. Linville
2007-10-29 20:58   ` Randy Dunlap
2007-10-29 21:06     ` John W. Linville

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.