On 08/04/16(Fri) 14:46, Patrick Wildt wrote:
> Hi,
> 
> so that we can easily check if a node is compatible or to find nodes
> that are compatible, I would like to add helpers to the fdt routines.
> 
> This way the drivers can check if they "match" to a node by simply
> calling:
> 
>       if (fdt_node_compatible(ma->ma_node, "samsung,exynos4210-ehci"))
>               return (1);
> 
> Sometimes it's helpful to find any node that is compatible.  It can
> be helpful for instance on finding the early uart.  Simplified example:
> 
>       if ((node = fdt_find_compatible("arm,pl011")) != NULL)
>               pl011cnattach(...);
> 
> Thoughts? ok?

Always hard to comment without seeing which code would use that.

Is a custom function really needed?  Why not do like sparc64 and macppc,
for example your ehci_match() could be:

{
        char compat[32];
        ...

        if (OF_getprop(ma->ma_node, "compatible", compat, sizeof(compat)) == -1)
                return 0;
        
        if (strcmp(compat, "samsung,exynos4210-ehci") == 0
                return 1;
        
        return 0;
}

Reply via email to