Re: [PATCH 02/04] ARM: shmobile: Add APMU DT support via Enable method

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Thu, May 21, 2015 at 3:22 AM, Magnus Damm <magnus.damm@xxxxxxxxx> wrote:
> --- 0001/arch/arm/mach-shmobile/platsmp-apmu.c
> +++ work/arch/arm/mach-shmobile/platsmp-apmu.c  2015-05-20 22:26:43.152366518 +0900

> +static void apmu_parse_dt(void (*fn)(struct resource *res, int cpu, int bit))
> +{
> +       struct device_node *np_apmu, *np_cpu;
> +       struct resource res;
> +       u32 id;
> +       int bit, index;
> +       bool is_allowed;
> +
> +       for_each_matching_node(np_apmu, apmu_ids) {
> +               /* only enable the cluster that includes the boot CPU */
> +               is_allowed = false;

You can declare the variable here instead of at the top of the function.

> +               for (bit = 0; bit < CONFIG_NR_CPUS; bit++) {
> +                       np_cpu = of_parse_phandle(np_apmu, "cpus", bit);
> +                       if (np_cpu) {
> +                               if (!of_property_read_u32(np_cpu, "reg", &id)) {
> +                                       if (id == cpu_logical_map(0))
> +                                               is_allowed = true;

You can do "of_node_put(np_cpu); break;" here, to stop scanning.

> +                               }
> +                               of_node_put(np_cpu);
> +                       }
> +               }
> +               if (!is_allowed)
> +                       continue;

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux