On Fri, Mar 16, 2007 at 12:28:53PM -0500, Scott Wood wrote:
> This adds a library function that platform code can call to set the mac
> addresses of network devices with a linux,network-index property,
> according to a caller-provided table of mac address pointers.
> 
> Signed-off-by: Scott Wood <scottwood at freescale.com>
And I had a function similar to this one, too.  But I think my version
is better.  Extracting it out of the patch I had in progress:
void __dt_fixup_mac_addresses(u32 startindex, ...)
{
       va_list ap;
       u32 index = startindex;
       void *devp;
       void *addr;
       va_start(ap, startindex);
       while ((addr = va_arg(ap, void *))) {
               devp = find_node_by_prop_value(NULL,
linux,network-index",
                                              &index, sizeof(index));
               if (devp)
                      setprop(devp, "local-mac-address", addr, 6);
       }
       va_end(ap);
}
Then a wrapper in the header file to make it more convenient:
#define dt_fixup_mac_addresses(...) \
       __dt_fixup_mac_addresses(0, __VA_ARGS__, NULL)
With this a cuboot platform can simply do:
	dt_fixup_mac_addresses(&bd.enetaddr, &bd.enet1addr, &bd.enet2addr);
or similar with as many parameters as are appropriate.
-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson