[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110223001639.GB26300@yookeroo>
Date: Wed, 23 Feb 2011 11:16:39 +1100
From: David Gibson <david@...son.dropbear.id.au>
To: David Daney <ddaney@...iumnetworks.com>
Cc: linux-mips@...ux-mips.org, ralf@...ux-mips.org,
devicetree-discuss@...ts.ozlabs.org, grant.likely@...retlab.ca,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 06/10] MIPS: Octeon: Initialize and fixup device
tree.
[snip]
> +}
> +
> +static int __init set_mac_addr_prop(struct device_node *n, u64 mac)
> +{
> + u8 *vp;
> + struct property *old_p;
> + struct property *p = kzalloc(sizeof(struct device_node) + 6, GFP_KERNEL);
> + if (!p)
> + return -ENOMEM;
> + /* The value will immediatly follow the node in memory. */
> + vp = (u8 *)(&p[1]);
> + p->name = "local-mac-address";
> + p->length = 6;
> + p->value = vp;
> +
> + vp[0] = (mac >> 40) & 0xff;
> + vp[1] = (mac >> 32) & 0xff;
> + vp[2] = (mac >> 24) & 0xff;
> + vp[3] = (mac >> 16) & 0xff;
> + vp[4] = (mac >> 8) & 0xff;
> + vp[5] = mac & 0xff;
> +
> + old_p = of_find_property(n, "local-mac-address", NULL);
> + if (old_p)
> + prom_remove_property(n, old_p);
> + return prom_add_property(n, p);
Hrm, since you entirely remove and replace the local-mac-address
property here, I don't see much point to having the property with a
bogus value in the .dts.
[snip]
> +int __init octeon_prune_device_tree(void)
> +{
> + int i, p, max_port;
> + const char *node_path;
> + char name_buffer[20];
> + struct device_node *aliases;
> + struct device_node *pip;
> + struct device_node *iface;
> + struct device_node *eth;
> + struct device_node *node;
> +
> + aliases = of_find_node_by_path("/aliases");
> + if (!aliases) {
> + pr_err("Error: No /aliases node in device tree.");
> + return -EINVAL;
> + }
Ok, I think the .dts could do with some more comments indicating that
it will be subject to extensive pruning before use.
--
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists