[PATCH 09/14] 85xx/sbc8548: read hardware revision when it's required for first time

Kumar Gala galak at kernel.crashing.org
Wed Jul 20 00:12:08 EST 2011


On Jul 19, 2011, at 3:53 AM, Dmitry Eremin-Solenikov wrote:

> Currently sbc8548 reads hardware revision during bootup. To simplify
> things read it when it's first required when the kernel is up and
> running.
> 
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov at gmail.com>
> ---
> arch/powerpc/platforms/85xx/sbc8548.c |    8 +++++---
> 1 files changed, 5 insertions(+), 3 deletions(-)

How is this simplifying things, seems more complicated to add an additional if() check.

- k

> 
> diff --git a/arch/powerpc/platforms/85xx/sbc8548.c b/arch/powerpc/platforms/85xx/sbc8548.c
> index ecdd8c0..2eeb376 100644
> --- a/arch/powerpc/platforms/85xx/sbc8548.c
> +++ b/arch/powerpc/platforms/85xx/sbc8548.c
> @@ -49,7 +49,7 @@
> #include <sysdev/fsl_soc.h>
> #include <sysdev/fsl_pci.h>
> 
> -static int sbc_rev;
> +static int sbc_rev = -EINVAL;
> 
> static void __init sbc8548_pic_init(void)
> {
> @@ -82,7 +82,7 @@ static void __init sbc8548_pic_init(void)
> }
> 
> /* Extract the HW Rev from the EPLD on the board */
> -static int __init sbc8548_hw_rev(void)
> +static int sbc8548_hw_rev(void)
> {
> 	struct device_node *np;
> 	struct resource res;
> @@ -130,7 +130,6 @@ static void __init sbc8548_setup_arch(void)
> 		}
> 	}
> #endif
> -	sbc_rev = sbc8548_hw_rev();
> }
> 
> static void sbc8548_show_cpuinfo(struct seq_file *m)
> @@ -140,6 +139,9 @@ static void sbc8548_show_cpuinfo(struct seq_file *m)
> 	pvid = mfspr(SPRN_PVR);
> 	svid = mfspr(SPRN_SVR);
> 
> +	if (sbc_rev == -EINVAL)
> +		sbc_rev = sbc8548_hw_rev();
> +
> 	seq_printf(m, "Vendor\t\t: Wind River\n");
> 	seq_printf(m, "Machine\t\t: SBC8548 v%d\n", sbc_rev);
> 	seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
> -- 
> 1.7.2.5



More information about the Linuxppc-dev mailing list