From: David Gibson <david@gibson.dropbear.id.au>
To: David Daney <ddaney@caviumnetworks.com>
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org,
devicetree-discuss@lists.ozlabs.org, grant.likely@secretlab.ca,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 06/10] MIPS: Octeon: Initialize and fixup device tree.
Date: Wed, 23 Feb 2011 11:16:39 +1100 [thread overview]
Message-ID: <20110223001639.GB26300@yookeroo> (raw)
In-Reply-To: <1298408274-20856-7-git-send-email-ddaney@caviumnetworks.com>
[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
next prev parent reply other threads:[~2011-02-23 0:16 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-22 20:57 [RFC PATCH 00/10] MIPS: Octeon: Use Device Tree David Daney
2011-02-22 20:57 ` [RFC PATCH 01/10] MIPS: Octeon: Move some Ethernet support files out of staging David Daney
2011-02-23 14:48 ` Grant Likely
2011-02-23 17:36 ` David Daney
2011-02-22 20:57 ` [RFC PATCH 06/10] MIPS: Octeon: Initialize and fixup device tree David Daney
2011-02-23 0:16 ` David Gibson [this message]
2011-02-23 17:41 ` Grant Likely
[not found] ` <20110223174120.GG14597-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2011-02-23 18:40 ` David Daney
2011-02-23 18:51 ` Grant Likely
2011-02-23 19:20 ` David Daney
2011-02-22 20:57 ` [RFC PATCH 07/10] i2c: Convert i2c-octeon.c to use " David Daney
2011-02-23 16:25 ` Grant Likely
[not found] ` <1298408274-20856-1-git-send-email-ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
2011-02-22 20:57 ` [RFC PATCH 02/10] MIPS: Octeon: Add device tree source files David Daney
2011-02-23 0:07 ` David Gibson
2011-02-23 14:30 ` Ralf Baechle
2011-02-23 16:59 ` David Daney
[not found] ` <4D653CF1.30009-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
2011-02-24 23:19 ` David Gibson
2011-02-25 15:22 ` Grant Likely
2011-02-25 21:46 ` Benjamin Herrenschmidt
2011-02-23 19:06 ` David Daney
[not found] ` <4D655AB6.80400-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
2011-02-23 23:49 ` David Gibson
2011-02-24 1:57 ` David Daney
[not found] ` <4D65BB17.4060703-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
2011-02-24 2:14 ` David Gibson
2011-02-24 2:22 ` David Daney
2011-02-22 20:57 ` [RFC PATCH 03/10] MIPS: Prune some target specific code out of prom.c David Daney
2011-02-22 20:57 ` [RFC PATCH 04/10] MIPS: Octeon: Add a irq_create_of_mapping() implementation David Daney
2011-02-22 20:57 ` [RFC PATCH 05/10] MIPS: Octeon: Rearrance CVMX files in preperation for device tree David Daney
2011-02-22 20:57 ` [RFC PATCH 08/10] netdev: mdio-octeon.c: Convert to use " David Daney
2011-02-22 20:57 ` [RFC PATCH 10/10] staging: octeon_ethernet: " David Daney
2011-02-22 20:57 ` [RFC PATCH 09/10] netdev: octeon_mgmt: " David Daney
[not found] ` <1298408274-20856-10-git-send-email-ddaney-M3mlKVOIwJVv6pq1l3V1OdBPR1lH4CV8@public.gmane.org>
2011-02-23 16:32 ` Grant Likely
2011-02-23 20:33 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110223001639.GB26300@yookeroo \
--to=david@gibson.dropbear.id.au \
--cc=ddaney@caviumnetworks.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox