devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of/pdt: fix section mismatch warning
@ 2011-12-27 22:04 Sam Ravnborg
       [not found] ` <20111227220408.GA18932-OoSGOWW0KRunlFQ6Q1D1Y0B+6BGkLq7r@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Sam Ravnborg @ 2011-12-27 22:04 UTC (permalink / raw)
  To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ; +Cc: David S. Miller

>From faff5f5b55c50e8ea06b62bd6b97f30d38a2da3a Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam-uyr5N9Q2VtJg9hUCZPvPmw@public.gmane.org>
Date: Tue, 27 Dec 2011 22:58:40 +0100
Subject: [PATCH] of/pdt: fix section mismatch warning

Fix the following section mismatch warning - seen when building sparc32:

WARNING: vmlinux.o(.text+0x1ff9c0): Section mismatch in reference from the function kernel_tree_alloc() to the function .init.text:prom_early_alloc()
The function kernel_tree_alloc() references
the function __init prom_early_alloc().
This is often because kernel_tree_alloc lacks a __init
annotation or the annotation of prom_early_alloc is wrong.

prom_early_alloc() is annotated __init, and users of
kernel_tree_alloc() is also annotated __init.
So simply match the annoation of these to fix the warning.

Signed-off-by: Sam Ravnborg <sam-uyr5N9Q2VtJg9hUCZPvPmw@public.gmane.org>
Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Cc: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
---
 drivers/of/pdt.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/of/pdt.c b/drivers/of/pdt.c
index bc5b399..07cc1d6 100644
--- a/drivers/of/pdt.c
+++ b/drivers/of/pdt.c
@@ -229,7 +229,7 @@ static struct device_node * __init of_pdt_build_tree(struct device_node *parent,
 	return ret;
 }
 
-static void *kernel_tree_alloc(u64 size, u64 align)
+static void * __init kernel_tree_alloc(u64 size, u64 align)
 {
 	return prom_early_alloc(size);
 }
-- 
1.6.0.6

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

* Re: [PATCH] of/pdt: fix section mismatch warning
       [not found] ` <20111227220408.GA18932-OoSGOWW0KRunlFQ6Q1D1Y0B+6BGkLq7r@public.gmane.org>
@ 2011-12-27 22:13   ` David Miller
       [not found]     ` <20111227.171307.1727824866350984198.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2011-12-27 22:13 UTC (permalink / raw)
  To: sam-uyr5N9Q2VtJg9hUCZPvPmw; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

From: Sam Ravnborg <sam-uyr5N9Q2VtJg9hUCZPvPmw@public.gmane.org>
Date: Tue, 27 Dec 2011 23:04:08 +0100

> prom_early_alloc() is annotated __init, and users of
> kernel_tree_alloc() is also annotated __init.
> So simply match the annoation of these to fix the warning.

Not exactly.

drivers/of/fdt.c:of_fdt_unflatten_tree() is not marked __init but does
pass kernel_tree_alloc in as a callback to __unflatten_device_tree()

So I don't think we can't just mark kernel_tree_alloc as __init to fix
this problem.

of_fdt_unflatten_tree() seems to be invokable at arbitrary points in
time, even long after we boot up, so I think we'll end up having to
unravel things to other way, removing the __init tag from the various
implementations of prom_early_alloc().

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

* Re: [PATCH] of/pdt: fix section mismatch warning
       [not found]     ` <20111227.171307.1727824866350984198.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
@ 2011-12-27 22:26       ` Sam Ravnborg
       [not found]         ` <20111227222658.GA19202-OoSGOWW0KRunlFQ6Q1D1Y0B+6BGkLq7r@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Sam Ravnborg @ 2011-12-27 22:26 UTC (permalink / raw)
  To: David Miller; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

On Tue, Dec 27, 2011 at 05:13:07PM -0500, David Miller wrote:
> From: Sam Ravnborg <sam-uyr5N9Q2VtJg9hUCZPvPmw@public.gmane.org>
> Date: Tue, 27 Dec 2011 23:04:08 +0100
> 
> > prom_early_alloc() is annotated __init, and users of
> > kernel_tree_alloc() is also annotated __init.
> > So simply match the annoation of these to fix the warning.
> 
> Not exactly.
> 
> drivers/of/fdt.c:of_fdt_unflatten_tree() is not marked __init but does
> pass kernel_tree_alloc in as a callback to __unflatten_device_tree()

We have two implementations of kernel_tree_alloc() - one in fdt.c and
another in pdt.c.

$ grep kernel_tree_alloc *
fdt.c:static void *kernel_tree_alloc(u64 size, u64 align)
fdt.c:  __unflatten_device_tree(device_tree, mynodes, &kernel_tree_alloc);
pdt.c:static void * __init kernel_tree_alloc(u64 size, u64 align)
pdt.c:  of_alias_scan(kernel_tree_alloc);

The version in fdt.c is using kzalloc() whereas the version in pdt.c
uses prom_early_alloc().

And of_fdt_unflatten_tree() uses the version in fdt.c - so the patch is OK.

It is confusing that they have the same name - but I did nto fix that.
And I forgot about this detail when I wrote the changelog.
[The christmas vacation effect it seems]

	Sam

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

* Re: [PATCH] of/pdt: fix section mismatch warning
       [not found]         ` <20111227222658.GA19202-OoSGOWW0KRunlFQ6Q1D1Y0B+6BGkLq7r@public.gmane.org>
@ 2011-12-27 22:29           ` David Miller
       [not found]             ` <20111227.172921.750063350996279524.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2011-12-27 22:29 UTC (permalink / raw)
  To: sam-uyr5N9Q2VtJg9hUCZPvPmw; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

From: Sam Ravnborg <sam-uyr5N9Q2VtJg9hUCZPvPmw@public.gmane.org>
Date: Tue, 27 Dec 2011 23:26:58 +0100

> We have two implementations of kernel_tree_alloc() - one in fdt.c and
> another in pdt.c.
> 
> $ grep kernel_tree_alloc *
> fdt.c:static void *kernel_tree_alloc(u64 size, u64 align)
> fdt.c:  __unflatten_device_tree(device_tree, mynodes, &kernel_tree_alloc);
> pdt.c:static void * __init kernel_tree_alloc(u64 size, u64 align)
> pdt.c:  of_alias_scan(kernel_tree_alloc);
> 
> The version in fdt.c is using kzalloc() whereas the version in pdt.c
> uses prom_early_alloc().
> 
> And of_fdt_unflatten_tree() uses the version in fdt.c - so the patch is OK.
> 
> It is confusing that they have the same name - but I did nto fix that.
> And I forgot about this detail when I wrote the changelog.

Ok, I hadn't realized this, thanks for explaining.

I think Grant should apply your patch then:

Acked-by: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>

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

* Re: [PATCH] of/pdt: fix section mismatch warning
       [not found]             ` <20111227.172921.750063350996279524.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
@ 2011-12-27 22:54               ` Rob Herring
       [not found]                 ` <4EFA4C8F.5080901-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Rob Herring @ 2011-12-27 22:54 UTC (permalink / raw)
  To: David Miller, sam-uyr5N9Q2VtJg9hUCZPvPmw
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

On 12/27/2011 04:29 PM, David Miller wrote:
> From: Sam Ravnborg <sam-uyr5N9Q2VtJg9hUCZPvPmw@public.gmane.org>
> Date: Tue, 27 Dec 2011 23:26:58 +0100
> 
>> We have two implementations of kernel_tree_alloc() - one in fdt.c and
>> another in pdt.c.
>>
>> $ grep kernel_tree_alloc *
>> fdt.c:static void *kernel_tree_alloc(u64 size, u64 align)
>> fdt.c:  __unflatten_device_tree(device_tree, mynodes, &kernel_tree_alloc);
>> pdt.c:static void * __init kernel_tree_alloc(u64 size, u64 align)
>> pdt.c:  of_alias_scan(kernel_tree_alloc);
>>
>> The version in fdt.c is using kzalloc() whereas the version in pdt.c
>> uses prom_early_alloc().
>>
>> And of_fdt_unflatten_tree() uses the version in fdt.c - so the patch is OK.
>>
>> It is confusing that they have the same name - but I did nto fix that.
>> And I forgot about this detail when I wrote the changelog.
> 
> Ok, I hadn't realized this, thanks for explaining.
> 
> I think Grant should apply your patch then:
> 
> Acked-by: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
> _______________________________________________

I've applied it for 3.3 unless you think it needs to go into 3.2.

Rob

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

* Re: [PATCH] of/pdt: fix section mismatch warning
       [not found]                 ` <4EFA4C8F.5080901-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2011-12-27 23:03                   ` David Miller
  2011-12-27 23:07                   ` Sam Ravnborg
  1 sibling, 0 replies; 7+ messages in thread
From: David Miller @ 2011-12-27 23:03 UTC (permalink / raw)
  To: robherring2-Re5JQEeQqe8AvxtiuMwx3w
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	sam-uyr5N9Q2VtJg9hUCZPvPmw

From: Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Date: Tue, 27 Dec 2011 16:54:07 -0600

> On 12/27/2011 04:29 PM, David Miller wrote:
>> From: Sam Ravnborg <sam-uyr5N9Q2VtJg9hUCZPvPmw@public.gmane.org>
>> Date: Tue, 27 Dec 2011 23:26:58 +0100
>> 
>>> We have two implementations of kernel_tree_alloc() - one in fdt.c and
>>> another in pdt.c.
>>>
>>> $ grep kernel_tree_alloc *
>>> fdt.c:static void *kernel_tree_alloc(u64 size, u64 align)
>>> fdt.c:  __unflatten_device_tree(device_tree, mynodes, &kernel_tree_alloc);
>>> pdt.c:static void * __init kernel_tree_alloc(u64 size, u64 align)
>>> pdt.c:  of_alias_scan(kernel_tree_alloc);
>>>
>>> The version in fdt.c is using kzalloc() whereas the version in pdt.c
>>> uses prom_early_alloc().
>>>
>>> And of_fdt_unflatten_tree() uses the version in fdt.c - so the patch is OK.
>>>
>>> It is confusing that they have the same name - but I did nto fix that.
>>> And I forgot about this detail when I wrote the changelog.
>> 
>> Ok, I hadn't realized this, thanks for explaining.
>> 
>> I think Grant should apply your patch then:
>> 
>> Acked-by: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
>> _______________________________________________
> 
> I've applied it for 3.3 unless you think it needs to go into 3.2.

It's not so critical for 3.2, thus targetting 3.3 is fine.

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

* Re: [PATCH] of/pdt: fix section mismatch warning
       [not found]                 ` <4EFA4C8F.5080901-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2011-12-27 23:03                   ` David Miller
@ 2011-12-27 23:07                   ` Sam Ravnborg
  1 sibling, 0 replies; 7+ messages in thread
From: Sam Ravnborg @ 2011-12-27 23:07 UTC (permalink / raw)
  To: Rob Herring; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, David Miller

On Tue, Dec 27, 2011 at 04:54:07PM -0600, Rob Herring wrote:
> On 12/27/2011 04:29 PM, David Miller wrote:
> > From: Sam Ravnborg <sam-uyr5N9Q2VtJg9hUCZPvPmw@public.gmane.org>
> > Date: Tue, 27 Dec 2011 23:26:58 +0100
> > 
> >> We have two implementations of kernel_tree_alloc() - one in fdt.c and
> >> another in pdt.c.
> >>
> >> $ grep kernel_tree_alloc *
> >> fdt.c:static void *kernel_tree_alloc(u64 size, u64 align)
> >> fdt.c:  __unflatten_device_tree(device_tree, mynodes, &kernel_tree_alloc);
> >> pdt.c:static void * __init kernel_tree_alloc(u64 size, u64 align)
> >> pdt.c:  of_alias_scan(kernel_tree_alloc);
> >>
> >> The version in fdt.c is using kzalloc() whereas the version in pdt.c
> >> uses prom_early_alloc().
> >>
> >> And of_fdt_unflatten_tree() uses the version in fdt.c - so the patch is OK.
> >>
> >> It is confusing that they have the same name - but I did nto fix that.
> >> And I forgot about this detail when I wrote the changelog.
> > 
> > Ok, I hadn't realized this, thanks for explaining.
> > 
> > I think Grant should apply your patch then:
> > 
> > Acked-by: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
> > _______________________________________________
> 
> I've applied it for 3.3 unless you think it needs to go into 3.2.
It is only silencing a warning so 3.3 is the right choice.

	Sam

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

end of thread, other threads:[~2011-12-27 23:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-27 22:04 [PATCH] of/pdt: fix section mismatch warning Sam Ravnborg
     [not found] ` <20111227220408.GA18932-OoSGOWW0KRunlFQ6Q1D1Y0B+6BGkLq7r@public.gmane.org>
2011-12-27 22:13   ` David Miller
     [not found]     ` <20111227.171307.1727824866350984198.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2011-12-27 22:26       ` Sam Ravnborg
     [not found]         ` <20111227222658.GA19202-OoSGOWW0KRunlFQ6Q1D1Y0B+6BGkLq7r@public.gmane.org>
2011-12-27 22:29           ` David Miller
     [not found]             ` <20111227.172921.750063350996279524.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2011-12-27 22:54               ` Rob Herring
     [not found]                 ` <4EFA4C8F.5080901-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-12-27 23:03                   ` David Miller
2011-12-27 23:07                   ` 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).