From patchwork Tue Sep 10 14:48:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 19909 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9CF0125EA3 for ; Tue, 10 Sep 2013 14:49:31 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id c41sf6143692yho.4 for ; Tue, 10 Sep 2013 07:49:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; 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=CrSFGAmA03PWQBqmmO3adFVLoTlCFMgEw6333IwjWYQ=; b=DckD8zfB+YQneA+CqyRcbwAwsZP//jzurbAUacSDh60vT43ksK/YC6D8pv5q1OUYSN KwcRby58DjgCeMORr0fw2THyKFlPFXCtH6CY/ELl8yImnrMjcJj334fgNOZx8WqEEG8i PJwjNMKvmHINpi1uaxkvTaTxRJ+xI77dRTnThPbitjIQr0Y6urZZBp/pU2oqepgFqTQo i/XwPmbihGvzAd4uSFyTV3LuHmV+uaQZvQRK2ydWeYuGQu/4gDFir6WX3k3cTVtqZ+D8 jlUpnKLu3fsOekYcurmOJbj9OY8j9XuxkZGJWP4F29vCaHrElMfezFJY8D4t7vAtJ2e9 s/cg== X-Received: by 10.236.109.134 with SMTP id s6mr8419359yhg.32.1378824571351; Tue, 10 Sep 2013 07:49:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.41.5 with SMTP id b5ls2276763qel.70.gmail; Tue, 10 Sep 2013 07:49:31 -0700 (PDT) X-Received: by 10.58.198.13 with SMTP id iy13mr23372280vec.11.1378824571097; Tue, 10 Sep 2013 07:49:31 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id t10si4522725vcr.110.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 07:49:31 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id ia10so4982042vcb.6 for ; Tue, 10 Sep 2013 07:49:31 -0700 (PDT) X-Gm-Message-State: ALoCoQlv0zdw3MdMyunpu3tMvxYwiRnCoHPUH1/izkKjpobTXRvJDNZERJsjgoJLZU7M4wunGPzV X-Received: by 10.52.119.139 with SMTP id ku11mr252846vdb.42.1378824571021; Tue, 10 Sep 2013 07:49:31 -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 u4csp4651vcz; Tue, 10 Sep 2013 07:49:30 -0700 (PDT) X-Received: by 10.14.209.133 with SMTP id s5mr319318eeo.104.1378824568974; Tue, 10 Sep 2013 07:49:28 -0700 (PDT) Received: from mail-ea0-f171.google.com (mail-ea0-f171.google.com [209.85.215.171]) by mx.google.com with ESMTPS id t9si3163964eeo.155.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 07:49:28 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.171 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.215.171; Received: by mail-ea0-f171.google.com with SMTP id n15so3953188ead.16 for ; Tue, 10 Sep 2013 07:49:28 -0700 (PDT) X-Received: by 10.14.8.72 with SMTP id 48mr39694988eeq.25.1378824568185; Tue, 10 Sep 2013 07:49:28 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id i1sm31911644eeg.0.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 07:49:27 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Cc: stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, patches@linaro.org, andre.przywara@linaro.org, Julien Grall Subject: [PATCH v3 06/27] xen/dts: Remove device_get_reg call in process_cpu_node Date: Tue, 10 Sep 2013 15:48:54 +0100 Message-Id: <1378824555-16564-7-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1378824555-16564-1-git-send-email-julien.grall@linaro.org> References: <1378824555-16564-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.220.175 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: , The "reg" property is only composed of one uint32. device_get_reg can be replaced by dt_read_number. Signed-off-by: Julien Grall Acked-by: Ian Campbell --- Changes in v2: - Rework the commit message --- xen/common/device_tree.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c index a73eee8..f867dfd 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c @@ -426,21 +426,26 @@ static void __init process_cpu_node(const void *fdt, int node, u32 address_cells, u32 size_cells) { const struct fdt_property *prop; - const u32 *cell; - paddr_t start, size; - + u32 cpuid; + int len; - prop = fdt_get_property(fdt, node, "reg", NULL); + prop = fdt_get_property(fdt, node, "reg", &len); if ( !prop ) { early_printk("fdt: node `%s': missing `reg' property\n", name); return; } - cell = (const u32 *)prop->data; - device_tree_get_reg(&cell, address_cells, size_cells, &start, &size); + if ( len < sizeof (cpuid) ) + { + dt_printk("fdt: node `%s': `reg` property length is too short\n", + name); + return; + } + + cpuid = dt_read_number((const __be32 *)prop->data, 1); - cpumask_set_cpu(start, &cpu_possible_map); + cpumask_set_cpu(cpuid, &cpu_possible_map); } static void __init process_multiboot_node(const void *fdt, int node,