2011-03-24 20:32:56

by Randy Dunlap

[permalink] [raw]
Subject: [PATCH] watchdog: fix nv_tco section mismatch

From: Randy Dunlap <[email protected]>

Fix section mismatch warning:
Mark the called nv_tco_getdevice() as __devinit, just like its caller.

WARNING: drivers/watchdog/nv_tco.o(.devinit.text+0x16): Section mismatch in reference from the function nv_tco_init() to the function .init.text:nv_tco_getdevice()
The function __devinit nv_tco_init() references
a function __init nv_tco_getdevice().
If nv_tco_getdevice is only used by nv_tco_init then
annotate nv_tco_getdevice with a matching annotation.

Signed-off-by: Randy Dunlap <[email protected]>
---
drivers/watchdog/nv_tco.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.38-git13.orig/drivers/watchdog/nv_tco.c
+++ linux-2.6.38-git13/drivers/watchdog/nv_tco.c
@@ -302,7 +302,7 @@ MODULE_DEVICE_TABLE(pci, tco_pci_tbl);
* Init & exit routines
*/

-static unsigned char __init nv_tco_getdevice(void)
+static unsigned char __devinit nv_tco_getdevice(void)
{
struct pci_dev *dev = NULL;
u32 val;


2011-03-25 23:43:01

by Mike Waychison

[permalink] [raw]
Subject: Re: [PATCH] watchdog: fix nv_tco section mismatch

On Thu, Mar 24, 2011 at 1:32 PM, Randy Dunlap <[email protected]> wrote:
> From: Randy Dunlap <[email protected]>
>
> Fix section mismatch warning:
> Mark the called nv_tco_getdevice() as __devinit, just like its caller.

This looks fine.

I can't seem to reproduce the warning on my end however, compiling
this as a built-in nor as a module. How do I trigger a difference
between __init and __devinit?

2011-03-26 01:43:17

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] watchdog: fix nv_tco section mismatch

On 03/25/11 16:42, Mike Waychison wrote:
> On Thu, Mar 24, 2011 at 1:32 PM, Randy Dunlap <[email protected]> wrote:
>> From: Randy Dunlap <[email protected]>
>>
>> Fix section mismatch warning:
>> Mark the called nv_tco_getdevice() as __devinit, just like its caller.
>
> This looks fine.
>
> I can't seem to reproduce the warning on my end however, compiling
> this as a built-in nor as a module. How do I trigger a difference
> between __init and __devinit?

I just used allmodconfig. But why wouldn't you see a differnence between
__init and __devinit? They are defined differently in include/linux/init.h,
but maybe on some $arch, those sections are treated differently?

I dunno.

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