From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: [PATCH v4 03/27] xen/dts: Don't add a fake property "name" in the device tree Date: Fri, 13 Sep 2013 13:49:10 +0100 Message-ID: <1379076574-28316-4-git-send-email-julien.grall@linaro.org> References: <1379076574-28316-1-git-send-email-julien.grall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1379076574-28316-1-git-send-email-julien.grall@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: patches@linaro.org, Julien Grall , ian.campbell@citrix.com, andre.przywara@linaro.org, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On new Flat Device Tree version, the property "name" may not exist. The property is never used in Xen code except to set the field "name" of dt_device_node. For convenience, remove the fake property. It will save space during the creation of the dom0 FDT. Signed-off-by: Julien Grall --- Changes in v3: - Reduce the divergence with Linux code --- xen/common/device_tree.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c index 2c2dc52..61134fe 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c @@ -1563,8 +1563,17 @@ static unsigned long __init unflatten_dt_node(const void *fdt, pp->name = "name"; pp->length = sz; pp->value = pp + 1; + /* + * The device tree creation code assume that the property + * "name" is not a fake. + * To avoid a big divergence with Linux code, only remove + * property link. In this case we will lose a bit of memory + */ +#if 0 *prev_pp = pp; prev_pp = &pp->next; +#endif + np->name = pp->value; memcpy(pp->value, ps, sz - 1); ((char *)pp->value)[sz - 1] = 0; dt_dprintk("fixed up name for %s -> %s\n", pathp, @@ -1574,7 +1583,7 @@ static unsigned long __init unflatten_dt_node(const void *fdt, if ( allnextpp ) { *prev_pp = NULL; - np->name = dt_get_property(np, "name", NULL); + np->name = (np->name) ? : dt_get_property(np, "name", NULL); np->type = dt_get_property(np, "device_type", NULL); if ( !np->name ) -- 1.7.10.4