[U-Boot] [PATCH 04/10] fdt: Add fdt_sizecell & fdt_addrcell helpers

Kumar Gala galak at kernel.crashing.org
Thu Oct 23 14:59:36 CEST 2008


>>>>
>>>
>>> Hi Kumar,
>>>
>>> What about collapsing the two above into a common function?
>>>
>>>    fdt_addrcell(blob);
>>> becomes
>>>    fdt_get_prop_u32(blob, "/", "#address-cells", 1);
>>> and
>>>    fdt_sizecell(blob);
>>> becomes
>>>    fdt_get_prop_u32(blob, "/", "#size-cells", 1);
>>>
>>> WARNING, UNTESTED CODE:
>>> /**
>>> * fdt_get_prop_u32: Find a node and return it's property or a  
>>> default
>>> *
>>> * @fdt: ptr to device tree
>>> * @node: path of node
>>> * @prop: property name
>>> * @defalt: default value if the property isn't found
>>> *
>>> * Convenience function to find a node and return it's property or a
>>> * default value if it doesn't exist.
>>> */
>>> u32 fdt_get_prop_u32(void *fdt, const char *node, const char *prop,
>>>             const u32 default)
>>> {
>>>    const u32 *addrcell = fdt_getprop(fdt, node, prop, NULL);
>>>
>>>    if (addrcell)
>>>        return *addrcell;
>>>    else
>>>        return default;
>>> }
>> I'd prefer we call it fdt_getprop_u32_default().  If you are good  
>> with the name I'll change my patchset.
>> - k
>
> That was my second choice.  I figured Dennis Richie would call me up  
> and complain the name was too long. ;-)
>
> I'm find with the change.
>
> Acked-by: Gerald Van Baren <vanbaren at cideas.com>
>
> Thanks,
> gvb

sent two new patches for you to ack.

- k


More information about the U-Boot mailing list