* [PATCH] Split initrd logic out of early_init_dt_scan_chosen() to fix warning
@ 2007-05-10 7:06 Michael Ellerman
2007-05-10 7:48 ` Geert Uytterhoeven
0 siblings, 1 reply; 3+ messages in thread
From: Michael Ellerman @ 2007-05-10 7:06 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
If CONFIG_BLK_DEV_INITRD is not defined the prop variable in
early_init_dt_scan_chosen() is unused, causing a compiler warning.
So split the initrd logic into a separate function, allowing us to
declare prop only when we need it.
Built for both cases and booted with an initrd.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
arch/powerpc/kernel/prom.c | 48 ++++++++++++++++++++++++++++++---------------
1 file changed, 32 insertions(+), 16 deletions(-)
Index: powerpc/arch/powerpc/kernel/prom.c
===================================================================
--- powerpc.orig/arch/powerpc/kernel/prom.c
+++ powerpc/arch/powerpc/kernel/prom.c
@@ -716,11 +716,41 @@ static int __init early_init_dt_scan_cpu
return 0;
}
+#ifdef CONFIG_BLK_DEV_INITRD
+static void __init early_init_dt_check_for_initrd(unsigned long node)
+{
+ unsigned long l;
+ u32 *prop;
+
+ DBG("Looking for initrd properties... ");
+
+ prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
+ if (prop) {
+ initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4));
+
+ prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
+ if (prop) {
+ initrd_end = (unsigned long)
+ __va(of_read_ulong(prop, l/4));
+ initrd_below_start_ok = 1;
+ } else {
+ initrd_start = 0;
+ }
+ }
+
+ DBG("initrd_start=0x%lx initrd_end=0x%lx\n", initrd_start, initrd_end);
+}
+#else
+static inline void early_init_dt_check_for_initrd(unsigned long node)
+{
+ return;
+}
+#endif /* CONFIG_BLK_DEV_INITRD */
+
static int __init early_init_dt_scan_chosen(unsigned long node,
const char *uname, int depth, void *data)
{
unsigned long *lprop;
- u32 *prop;
unsigned long l;
char *p;
@@ -762,21 +792,7 @@ static int __init early_init_dt_scan_cho
crashk_res.end = crashk_res.start + *lprop - 1;
#endif
-#ifdef CONFIG_BLK_DEV_INITRD
- DBG("Looking for initrd properties... ");
- prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
- if (prop) {
- initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4));
- prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
- if (prop) {
- initrd_end = (unsigned long)__va(of_read_ulong(prop, l/4));
- initrd_below_start_ok = 1;
- } else {
- initrd_start = 0;
- }
- }
- DBG("initrd_start=0x%lx initrd_end=0x%lx\n", initrd_start, initrd_end);
-#endif /* CONFIG_BLK_DEV_INITRD */
+ early_init_dt_check_for_initrd(node);
/* Retreive command line */
p = of_get_flat_dt_prop(node, "bootargs", &l);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Split initrd logic out of early_init_dt_scan_chosen() to fix warning
2007-05-10 7:06 [PATCH] Split initrd logic out of early_init_dt_scan_chosen() to fix warning Michael Ellerman
@ 2007-05-10 7:48 ` Geert Uytterhoeven
2007-05-10 7:57 ` Michael Ellerman
0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2007-05-10 7:48 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev, Paul Mackerras
On Thu, 10 May 2007, Michael Ellerman wrote:
> If CONFIG_BLK_DEV_INITRD is not defined the prop variable in
> early_init_dt_scan_chosen() is unused, causing a compiler warning.
>
> So split the initrd logic into a separate function, allowing us to
> declare prop only when we need it.
>
> Built for both cases and booted with an initrd.
>
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> ---
>
> arch/powerpc/kernel/prom.c | 48 ++++++++++++++++++++++++++++++---------------
> 1 file changed, 32 insertions(+), 16 deletions(-)
>
> Index: powerpc/arch/powerpc/kernel/prom.c
> ===================================================================
> --- powerpc.orig/arch/powerpc/kernel/prom.c
> +++ powerpc/arch/powerpc/kernel/prom.c
> @@ -716,11 +716,41 @@ static int __init early_init_dt_scan_cpu
> return 0;
> }
>
> +#ifdef CONFIG_BLK_DEV_INITRD
> +#else
> +static inline void early_init_dt_check_for_initrd(unsigned long node)
> +{
> + return;
> +}
> +#endif /* CONFIG_BLK_DEV_INITRD */
There's no need to use `return' in functions returning void.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- Sony Network and Software Technology Center Europe (NSCE)
Geert.Uytterhoeven@sonycom.com ------- The Corporate Village, Da Vincilaan 7-D1
Voice +32-2-7008453 Fax +32-2-7008622 ---------------- B-1935 Zaventem, Belgium
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Split initrd logic out of early_init_dt_scan_chosen() to fix warning
2007-05-10 7:48 ` Geert Uytterhoeven
@ 2007-05-10 7:57 ` Michael Ellerman
0 siblings, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2007-05-10 7:57 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linuxppc-dev, Paul Mackerras
[-- Attachment #1: Type: text/plain, Size: 1526 bytes --]
On Thu, 2007-05-10 at 09:48 +0200, Geert Uytterhoeven wrote:
> On Thu, 10 May 2007, Michael Ellerman wrote:
> > If CONFIG_BLK_DEV_INITRD is not defined the prop variable in
> > early_init_dt_scan_chosen() is unused, causing a compiler warning.
> >
> > So split the initrd logic into a separate function, allowing us to
> > declare prop only when we need it.
> >
> > Built for both cases and booted with an initrd.
> >
> > Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> > ---
> >
> > arch/powerpc/kernel/prom.c | 48 ++++++++++++++++++++++++++++++---------------
> > 1 file changed, 32 insertions(+), 16 deletions(-)
> >
> > Index: powerpc/arch/powerpc/kernel/prom.c
> > ===================================================================
> > --- powerpc.orig/arch/powerpc/kernel/prom.c
> > +++ powerpc/arch/powerpc/kernel/prom.c
> > @@ -716,11 +716,41 @@ static int __init early_init_dt_scan_cpu
> > return 0;
> > }
> >
> > +#ifdef CONFIG_BLK_DEV_INITRD
>
> > +#else
> > +static inline void early_init_dt_check_for_initrd(unsigned long node)
> > +{
> > + return;
> > +}
> > +#endif /* CONFIG_BLK_DEV_INITRD */
>
> There's no need to use `return' in functions returning void.
I think it looks nicer :)
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-05-10 7:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-10 7:06 [PATCH] Split initrd logic out of early_init_dt_scan_chosen() to fix warning Michael Ellerman
2007-05-10 7:48 ` Geert Uytterhoeven
2007-05-10 7:57 ` Michael Ellerman
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).