Re: [PATCH] ARM: /proc/cpuinfo: DT: Add support for Revision

From: Andreas Färber
Date: Mon Jan 26 2015 - 17:34:44 EST


Am 26.01.2015 um 20:09 schrieb Pali Rohár:
> diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
> index 11c54de..9946c1b 100644
> --- a/arch/arm/kernel/devtree.c
> +++ b/arch/arm/kernel/devtree.c
[...]
> @@ -204,6 +206,8 @@ static const void * __init arch_get_next_mach(const char *const **match)
> const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
> {
> const struct machine_desc *mdesc, *mdesc_best = NULL;
> + unsigned long dt_root;
> + const u32 *prop;
>
> #ifdef CONFIG_ARCH_MULTIPLATFORM
> DT_MACHINE_START(GENERIC_DT, "Generic DT based system")
> @@ -215,17 +219,16 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
> if (!dt_phys || !early_init_dt_verify(phys_to_virt(dt_phys)))
> return NULL;
>
> + dt_root = of_get_flat_dt_root();
> mdesc = of_flat_dt_match_machine(mdesc_best, arch_get_next_mach);
>
> if (!mdesc) {
> const char *prop;

Probably the use of two differently typed variables of name "prop" in
this function is not intentional?

Regards,
Andreas

> int size;
> - unsigned long dt_root;
>
> early_print("\nError: unrecognized/unsupported "
> "device tree compatible list:\n[ ");
>
> - dt_root = of_get_flat_dt_root();
> prop = of_get_flat_dt_prop(dt_root, "compatible", &size);
> while (size > 0) {
> early_print("'%s' ", prop);
> @@ -246,5 +249,10 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
> /* Change machine number to match the mdesc we're using */
> __machine_arch_type = mdesc->nr;
>
> + /* Set system revision from DT */
> + prop = of_get_flat_dt_prop(dt_root, "revision", NULL);
> + if (prop)
> + system_rev = fdt32_to_cpu(*prop);
> +
> return mdesc;
> }
[snip]

--
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)

Attachment: signature.asc
Description: OpenPGP digital signature