From patchwork Fri Aug 16 21:05:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 19256 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f69.google.com (mail-qe0-f69.google.com [209.85.128.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AB8FF248E6 for ; Fri, 16 Aug 2013 21:06:20 +0000 (UTC) Received: by mail-qe0-f69.google.com with SMTP id 1sf2886323qec.8 for ; Fri, 16 Aug 2013 14:06:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=prFS4aJNTSpcjBDO/Fyh+1bCGQhAWnYWR9CWIPq6yM8=; b=XRpPcWC/s3sG6Ph0iKZxgIL0hHxDUZFKeoeON68+c+xL1O9VoopJG/3Li78Cvoj1fv 7Gp9kA12EJdaNROWh7vrbt+mFG6wTc4TeMn6LPnJHWVU3PcIKtPPefnD89LPRJjkVGvA bae3otd7MY7lG1cmOG52/ZJk2ytqwAybGZT8ZbPB0RdL0K9YKLqaVHwOR1Y82IqRbQMd UJhRc2cxQDPXMGzo3yN1s3hVIRzblpYn7Q4OtQmZ2yeAxmuR0T460Gsc2veoB85prFuR /NWhJTFT5XlmPsZJ43yZGXpdPrC0HBeN0GZPHqg65p/1/nqRQ63QZ3Gu3u2Zpfg0cF5q NQCA== X-Received: by 10.236.191.233 with SMTP id g69mr1081695yhn.54.1376687180421; Fri, 16 Aug 2013 14:06:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.121.195 with SMTP id lm3ls971252qeb.89.gmail; Fri, 16 Aug 2013 14:06:20 -0700 (PDT) X-Received: by 10.58.155.68 with SMTP id vu4mr2907852veb.21.1376687180294; Fri, 16 Aug 2013 14:06:20 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id xz7si781204vcb.50.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 Aug 2013 14:06:20 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id db10so1697871veb.14 for ; Fri, 16 Aug 2013 14:06:20 -0700 (PDT) X-Gm-Message-State: ALoCoQlRapsgPXV/QtAsLGTdD48HoXlxrL6fdUbY/elQ/NUQTmne+gqipiKs3/81HtsDsFdIzLTJ X-Received: by 10.52.103.35 with SMTP id ft3mr2479149vdb.5.1376687180204; Fri, 16 Aug 2013 14:06:20 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp89449vcz; Fri, 16 Aug 2013 14:06:19 -0700 (PDT) X-Received: by 10.180.198.115 with SMTP id jb19mr595540wic.28.1376687179301; Fri, 16 Aug 2013 14:06:19 -0700 (PDT) Received: from mail-we0-f171.google.com (mail-we0-f171.google.com [74.125.82.171]) by mx.google.com with ESMTPS id z13si245450wiv.17.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 Aug 2013 14:06:19 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.171 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.82.171; Received: by mail-we0-f171.google.com with SMTP id q55so2056343wes.2 for ; Fri, 16 Aug 2013 14:06:18 -0700 (PDT) X-Received: by 10.180.205.163 with SMTP id lh3mr600274wic.27.1376687178879; Fri, 16 Aug 2013 14:06:18 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id b13sm797327wic.9.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 Aug 2013 14:06:17 -0700 (PDT) From: Julien Grall To: stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com Cc: patches@linaro.org, andre.przywara@linaro.org, xen-devel@lists.xen.org, Julien Grall Subject: [RFC 08/24] xen/dts: Don't add a fake property "name" in the device tree Date: Fri, 16 Aug 2013 22:05:40 +0100 Message-Id: <1376687156-6737-9-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1376687156-6737-1-git-send-email-julien.grall@linaro.org> References: <1376687156-6737-1-git-send-email-julien.grall@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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)); + + 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 )