From patchwork Wed Aug 28 14:47:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 19573 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f199.google.com (mail-ye0-f199.google.com [209.85.213.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3A14C25E58 for ; Wed, 28 Aug 2013 14:48:19 +0000 (UTC) Received: by mail-ye0-f199.google.com with SMTP id l13sf6471562yen.10 for ; Wed, 28 Aug 2013 07:48:19 -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=49cYd4tIeeIPKO/9tS3OIyVkRwj1jpGn7UDtMsOnF2A=; b=cXUsthxANl67O6ciIOQv8/1oihx+WHYEOAtHPBtJH4SfDy1bw5wn9PrrnP3nGypYOk nVUcwtitTRRy6frPDWQv8TMSxY1Pun1UvwYMUM4ZjRp/rFxvEojrbOASq1rTBsF2003t CXId47NggtwUxsZ2+rzMAU3Y8hzlTkk81remmIaDe7KYRmBcIw/urVmgx2uMncWs55nw R9l9q4P8Fo9FhUNYP+93gjHeNfJQzWn0aNH4kZJD6X5g/MgCCVDFhXvGThqOFBA4hE5o oat1Qige/No3eLJKSrvBA7MAmYF/BmVqk7H1DIwAi1grRDgJsXqxHZLITNE7TRip2fvU UJCg== X-Received: by 10.236.156.138 with SMTP id m10mr10005655yhk.26.1377701299015; Wed, 28 Aug 2013 07:48:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.4.41 with SMTP id h9ls371648qeh.79.gmail; Wed, 28 Aug 2013 07:48:18 -0700 (PDT) X-Received: by 10.58.136.4 with SMTP id pw4mr26316646veb.10.1377701298863; Wed, 28 Aug 2013 07:48:18 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id uw3si6634381vec.20.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 28 Aug 2013 07:48:18 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.170 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.170; Received: by mail-vc0-f170.google.com with SMTP id kw10so4336235vcb.1 for ; Wed, 28 Aug 2013 07:48:18 -0700 (PDT) X-Gm-Message-State: ALoCoQmk6aBx2oRJcTMQij/gS65w3BNDRVWIKeK+N7xg5wrz1nLQgwTKlHfNwc617F/ZgWRsz2n7 X-Received: by 10.52.88.115 with SMTP id bf19mr1677947vdb.12.1377701298787; Wed, 28 Aug 2013 07:48:18 -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 u4csp359943vcz; Wed, 28 Aug 2013 07:48:18 -0700 (PDT) X-Received: by 10.194.250.69 with SMTP id za5mr2648361wjc.80.1377701297727; Wed, 28 Aug 2013 07:48:17 -0700 (PDT) Received: from mail-wg0-f41.google.com (mail-wg0-f41.google.com [74.125.82.41]) by mx.google.com with ESMTPS id dd4si9533741wjb.62.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 28 Aug 2013 07:48:17 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.41 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.82.41; Received: by mail-wg0-f41.google.com with SMTP id b12so157034wgh.4 for ; Wed, 28 Aug 2013 07:48:17 -0700 (PDT) X-Received: by 10.194.219.38 with SMTP id pl6mr3305878wjc.47.1377701297128; Wed, 28 Aug 2013 07:48:17 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id a8sm5590498wie.6.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 28 Aug 2013 07:48:16 -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 V1 10/29] xen/dts: Remove device_get_reg call in process_cpu_node Date: Wed, 28 Aug 2013 15:47:24 +0100 Message-Id: <1377701263-3319-11-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1377701263-3319-1-git-send-email-julien.grall@linaro.org> References: <1377701263-3319-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.170 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 833d67d..9568250 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,