Re: [PATCH 23/24] C6X: Power and Sleep Controller

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

 



On Monday 22 August 2011 16:09:44 Mark Salter wrote:
> +void __init psc_init(void)
> +{
> +       struct device_node *node;
> +       const __be32 *p;
> +       int i, len;
> +
> +       node = of_find_compatible_node(NULL, NULL, "ti,c64x+psc");
> +       if (!node)
> +               return;
> +
> +       psc.base = of_iomap(node, 0);
> +       if (!psc.base) {
> +               of_node_put(node);
> +               return;
> +       }
> +
> +       p = of_get_property(node, "ti,number-psc-domains", &len);
> +       if (p && len == sizeof(u32))
> +               psc.num_domains = be32_to_cpup(p);
> +
> +       p = of_get_property(node, "ti,number-psc-modules", &len);
> +       if (p && len == sizeof(u32))
> +               psc.num_modules = be32_to_cpup(p);
> +
> +       p = of_get_property(node, "ti,module-domain-map", &len);
> +       if (p) {
> +               len /= sizeof(u32);
> +               if (len > MAX_PSC_MODULES)
> +                       len = MAX_PSC_MODULES;
> +               for (i = 0; i <= len; i++)
> +                       psc.module_domains[i] = be32_to_cpup(&p[i]);
> +       }
> +
> +       of_node_put(node);
> +}

I think this should be a proper driver instead, using a struct platform_driver
and a match table instead the hacky of_find_compatible_node. That is generally
the preferred approach for any nonessential code that can be initialized later
and is not referenced by core code. As far as I can tell, this is the case
here, though I could not actually find the callers so far.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux