From: Ian Campbell Subject: Re: [RFC 08/24] xen/dts: Don't add a fake property "name" in the device tree Date: Thu, 22 Aug 2013 14:16:46 +0100 Message-ID: <1377177406.2825.9.camel@kazak.uk.xensource.com> References: <1376687156-6737-1-git-send-email-julien.grall@linaro.org> <1376687156-6737-9-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: <1376687156-6737-9-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: Julien Grall Cc: patches@linaro.org, xen-devel@lists.xen.org, andre.przywara@linaro.org, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On Fri, 2013-08-16 at 22:05 +0100, Julien Grall wrote: > 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 > --- > xen/common/device_tree.c | 21 +++++++++------------ > 1 file changed, 9 insertions(+), 12 deletions(-) > > diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c > index 362dd66..315b284 100644 > --- a/xen/common/device_tree.c > +++ b/xen/common/device_tree.c > @@ -1528,6 +1528,7 @@ static unsigned long __init unflatten_dt_node(const void *fdt, > if ( !has_name ) > { > char *p1 = pathp, *ps = pathp, *pa = NULL; > + char *tmp = NULL; > int sz; > > while ( *p1 ) > @@ -1541,25 +1542,21 @@ static unsigned long __init unflatten_dt_node(const void *fdt, > if ( pa < ps ) > pa = p1; > sz = (pa - ps) + 1; > - pp = unflatten_dt_alloc(&mem, sizeof(struct dt_property) + sz, > - __alignof__(struct dt_property)); pp appears to not be assigned anywhere else now? I'm not sure if prev_pp becomes obsolete or not. > + > + tmp = unflatten_dt_alloc(&mem, sz, 1); > if ( allnextpp ) > { > - pp->name = "name"; > - pp->length = sz; > - pp->value = pp + 1; > - *prev_pp = pp; > - prev_pp = &pp->next; > - memcpy(pp->value, ps, sz - 1); > - ((char *)pp->value)[sz - 1] = 0; > - dt_dprintk("fixed up name for %s -> %s\n", pathp, > - (char *)pp->value); > + memcpy(tmp, ps, sz - 1); > + np->name = tmp; > + tmp[sz - 1] = 0; > + dt_dprintk("fixed up name for %s -> %s\n", pathp, np->name); > } > } > + > 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 )