From patchwork Fri Sep 13 12:49:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 20032 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f72.google.com (mail-qe0-f72.google.com [209.85.128.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7ED4128E99 for ; Fri, 13 Sep 2013 12:49:47 +0000 (UTC) Received: by mail-qe0-f72.google.com with SMTP id 6sf1195008qea.11 for ; Fri, 13 Sep 2013 05:49:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version: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=Cu85TiaijC0Z1SC6L0XmOxoo6CzienAWXKJB6rsri2uld1u26Je7YRPS5RBZssbT6k x7+YmRPYF4XMZ8iJ1BLiNEpO03nhdDYrDIGx6pT0NlHhHDUAop89PY9StvkSs6ixZlsL 3MFLKMHix2NQfDmss7ryiiokqEfi4hgwJ3pwj1RP0zRxmwy6pbwTARacxlohmMsAU0tj fQTDaLKOg8oHD6Gg5xZhbQOyqhpNSURdliTaC1jL+I26Riajo0C64GLIkn/bSWW7r3XS Q8GPpCvBvb1PCfJKmPo7eqjDKr1J4ogSLVGz5tW/034TG35EqClnR0h5Q69uHkZE+cry PJ/w== X-Gm-Message-State: ALoCoQno1/GT04HK/Oh2rS4A7Whw/hyzFX5q+WBLsyD7w1ksl0EcWl83hdQwNWVFzTfjYWreyQRx X-Received: by 10.236.6.134 with SMTP id 6mr5254273yhn.7.1379076587313; Fri, 13 Sep 2013 05:49:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.1.102 with SMTP id 6ls1062847qel.40.gmail; Fri, 13 Sep 2013 05:49:47 -0700 (PDT) X-Received: by 10.220.181.136 with SMTP id by8mr12077155vcb.11.1379076587097; Fri, 13 Sep 2013 05:49:47 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id f20si3061862vcs.142.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 05:49:47 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.181 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.181; Received: by mail-ve0-f181.google.com with SMTP id oy12so905984veb.40 for ; Fri, 13 Sep 2013 05:49:47 -0700 (PDT) X-Received: by 10.58.196.132 with SMTP id im4mr962513vec.28.1379076587022; Fri, 13 Sep 2013 05:49:47 -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 u4csp78770vcz; Fri, 13 Sep 2013 05:49:46 -0700 (PDT) X-Received: by 10.15.56.199 with SMTP id y47mr1339799eew.73.1379076585980; Fri, 13 Sep 2013 05:49:45 -0700 (PDT) Received: from mail-ea0-f170.google.com (mail-ea0-f170.google.com [209.85.215.170]) by mx.google.com with ESMTPS id f46si3776272eeo.159.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 05:49:45 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.170 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.215.170; Received: by mail-ea0-f170.google.com with SMTP id h14so558769eak.29 for ; Fri, 13 Sep 2013 05:49:45 -0700 (PDT) X-Received: by 10.14.113.137 with SMTP id a9mr17871019eeh.3.1379076585204; Fri, 13 Sep 2013 05:49:45 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id p5sm14678420eeg.5.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 05:49:44 -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 v4 06/27] xen/dts: Remove device_get_reg call in process_cpu_node Date: Fri, 13 Sep 2013 13:49:13 +0100 Message-Id: <1379076574-28316-7-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1379076574-28316-1-git-send-email-julien.grall@linaro.org> References: <1379076574-28316-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.181 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,