Received: by 10.192.165.148 with SMTP id m20csp1356030imm; Wed, 25 Apr 2018 17:32:20 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/Dj1KO9/bFnMJ28Bxj1kalIsm8zZm2xkcwrsMuGEJcT7rdr1w9wBO3yG/QzxGX1dPcOVDB X-Received: by 10.98.162.2 with SMTP id m2mr30161952pff.251.1524702739966; Wed, 25 Apr 2018 17:32:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524702739; cv=none; d=google.com; s=arc-20160816; b=vozcHYv/tAHcESpI2Dsja5+9WjobD+gjHbd1E8FWrEyZbS4WFiPkLrO/VL2nfYl56f +L1pETYpDMJoyFohSSYkRTFCpRkchBdk2K4wF2vI2QqSFo5LJx7P8wGajdcR/J2I6S+x kUJfwjDmt5Qav9cB+AFJ8TdZ/ezVo4Moxy3doDMFpUM9fakccl5b5XVJKx8i9p+bzeJ3 gBxzPaNzBAGMUOMgoIbM8HFIEER1Ii+K8rS9v5yS3Yn2oHuVg5IhJwEuTByMF1XWi5d4 bvZAExEulVUn8ckTGGJAO0tKU0g8A9xDMuDkJD8sM8TtCNXyQ4FF6aEtb2n12h2Go8V5 s1SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=XLke42KokNfQqxobaF9UWr4WeK8Zqg/cFZzrBESXMmI=; b=wxa7MJ5XxSpINDZvaP5Pe4hR5Rato+QqsdTL+Wg1KZWEvx5yuk7Q5XhWN4Lr8hpgeh CYhesmkF5D1n7i7tUj9C+l5qgYt0/sp5+uLJzcoJgBx4lTsw71Bj1ex4laTbkg59HcVg H/20UJFIDTZY2D245D8OPmvyadYZkKYan1a5oWXWlq7PH7SOjjy0P47xGxbIcnAs4HGF daErqzLV4e5IPXPJK4vmtkGoskYgAsbfXyij8sUGrvJ2mCWr2YuqySnYqSGVONTh4jHB 35KUV2RLCImPKGgys4ZjOUMNxPUgSfKUFdZ/XM9owGBHtJ8+shGjcUdGXutwDwkCf3Wy i5wA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q12-v6si17551119plk.559.2018.04.25.17.32.05; Wed, 25 Apr 2018 17:32:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753877AbeDZA3G (ORCPT + 99 others); Wed, 25 Apr 2018 20:29:06 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:45592 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751298AbeDZA0I (ORCPT ); Wed, 25 Apr 2018 20:26:08 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3F1FF15AD; Wed, 25 Apr 2018 17:26:08 -0700 (PDT) Received: from beelzebub.austin.arm.com (beelzebub.austin.arm.com [10.118.12.119]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2CBD13F590; Wed, 25 Apr 2018 17:26:07 -0700 (PDT) From: Jeremy Linton To: linux-acpi@vger.kernel.org Cc: Sudeep.Holla@arm.com, linux-arm-kernel@lists.infradead.org, Lorenzo.Pieralisi@arm.com, hanjun.guo@linaro.org, rjw@rjwysocki.net, Will.Deacon@arm.com, Catalin.Marinas@arm.com, gregkh@linuxfoundation.org, Mark.Rutland@arm.com, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, wangxiongfeng2@huawei.com, vkilari@codeaurora.org, ahs3@redhat.com, Dietmar.Eggemann@arm.com, Morten.Rasmussen@arm.com, palmer@sifive.com, lenb@kernel.org, john.garry@huawei.com, austinwc@codeaurora.org, tnowicki@caviumnetworks.com, jhugo@qti.qualcomm.com, timur@qti.qualcomm.com, ard.biesheuvel@linaro.org, Jeremy Linton Subject: [PATCH v8 01/13] drivers: base: cacheinfo: move cache_setup_of_node() Date: Wed, 25 Apr 2018 18:31:09 -0500 Message-Id: <20180425233121.13270-2-jeremy.linton@arm.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180425233121.13270-1-jeremy.linton@arm.com> References: <20180425233121.13270-1-jeremy.linton@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation for the next patch, and to aid in review of that patch, lets move cache_setup_of_node further down in the module without any changes. Signed-off-by: Jeremy Linton Reviewed-by: Sudeep Holla --- drivers/base/cacheinfo.c | 80 ++++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index edf726267282..09ccef7ddc99 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -32,46 +32,6 @@ struct cpu_cacheinfo *get_cpu_cacheinfo(unsigned int cpu) } #ifdef CONFIG_OF -static int cache_setup_of_node(unsigned int cpu) -{ - struct device_node *np; - struct cacheinfo *this_leaf; - struct device *cpu_dev = get_cpu_device(cpu); - struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); - unsigned int index = 0; - - /* skip if of_node is already populated */ - if (this_cpu_ci->info_list->of_node) - return 0; - - if (!cpu_dev) { - pr_err("No cpu device for CPU %d\n", cpu); - return -ENODEV; - } - np = cpu_dev->of_node; - if (!np) { - pr_err("Failed to find cpu%d device node\n", cpu); - return -ENOENT; - } - - while (index < cache_leaves(cpu)) { - this_leaf = this_cpu_ci->info_list + index; - if (this_leaf->level != 1) - np = of_find_next_cache_node(np); - else - np = of_node_get(np);/* cpu node itself */ - if (!np) - break; - this_leaf->of_node = np; - index++; - } - - if (index != cache_leaves(cpu)) /* not all OF nodes populated */ - return -ENOENT; - - return 0; -} - static inline bool cache_leaves_are_shared(struct cacheinfo *this_leaf, struct cacheinfo *sib_leaf) { @@ -202,6 +162,46 @@ static void cache_of_override_properties(unsigned int cpu) cache_associativity(this_leaf); } } + +static int cache_setup_of_node(unsigned int cpu) +{ + struct device_node *np; + struct cacheinfo *this_leaf; + struct device *cpu_dev = get_cpu_device(cpu); + struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); + unsigned int index = 0; + + /* skip if of_node is already populated */ + if (this_cpu_ci->info_list->of_node) + return 0; + + if (!cpu_dev) { + pr_err("No cpu device for CPU %d\n", cpu); + return -ENODEV; + } + np = cpu_dev->of_node; + if (!np) { + pr_err("Failed to find cpu%d device node\n", cpu); + return -ENOENT; + } + + while (index < cache_leaves(cpu)) { + this_leaf = this_cpu_ci->info_list + index; + if (this_leaf->level != 1) + np = of_find_next_cache_node(np); + else + np = of_node_get(np);/* cpu node itself */ + if (!np) + break; + this_leaf->of_node = np; + index++; + } + + if (index != cache_leaves(cpu)) /* not all OF nodes populated */ + return -ENOENT; + + return 0; +} #else static void cache_of_override_properties(unsigned int cpu) { } static inline int cache_setup_of_node(unsigned int cpu) { return 0; } -- 2.13.6