From patchwork Sat Jan 13 00:59:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 124393 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp71583qgn; Fri, 12 Jan 2018 17:00:43 -0800 (PST) X-Google-Smtp-Source: ACJfBoucr0ZFTbbwBlTHUcezRf/D/oMkQi+ZQslvR2BidaL/Dg1ftaXeZ0r23IKyRF7Ka3OC+yGG X-Received: by 10.84.130.101 with SMTP id 92mr27923115plc.82.1515805243148; Fri, 12 Jan 2018 17:00:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515805243; cv=none; d=google.com; s=arc-20160816; b=DJ+Y4LNIJWOnNhXEeSWHy1zaotA220+ZW+AJ33YdCwwyb25aYmY2D9UnMUzqauXrqC t9yk5Fp2uQ4YH0bedmeJMLWqbHfuVF6BCC2ar4O6RN5U2U09JxCQTSeAmHfSv+64nrQI jrCLrqZ51QOvfAeQ/J2Y3e0yiiPbXTFAj32gLsul7YqPqvhECkvMK0eKBpJ0SZJJq351 gHOsSwwhjtF6jPzwGs1gE9f+NqYfHfKKx9IUG8mPB+pVCvEcUugsvWqMjEFb1BWG0DA6 PDkigo6ksW7sz73fCtbVb/UbZvQs0m3y/9JpzT92HxIWl5O+h+5qNbE6ZaNzpuKWnmZu /Psw== 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=huzKoy4QMT/zdVlO798S9yqColhSf3wKhYceU5eoVGw=; b=0CnqNm4q8WOYHZnaG8lSO58nvhJUCbBD2DfwJshbEQU7a1E1C4KS1QYNyPQJuIDsw2 YalT5o5GoVs2ew6q8hukgYiWZEb+Qu00RrBTpmRmyZkUhezxQAK8wshn09RS3QChpMNV 2fU9B66wVrsLFITibYgHb9+VYV+L99CeiJp42NfkAhEyHlNkj0oQqD5PK/vN3FMxI8YJ elawGtWOvf+OcP6836EhMirHpxYUuRX4UYOQb5qCo2xTa3VSCO6UKoNNFDRMv7ZpYOgt Ilay1hPzkeCiphMiiC9LTVWTJ/QuowaI6i5GfaLTSzx3NSEsApq0pQPz3bCuIOaB12uR MG0g== 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 d13si7410495pgu.579.2018.01.12.17.00.42; Fri, 12 Jan 2018 17:00:43 -0800 (PST) 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 S965441AbeAMBAl (ORCPT + 28 others); Fri, 12 Jan 2018 20:00:41 -0500 Received: from foss.arm.com ([217.140.101.70]:53754 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965260AbeAMBAi (ORCPT ); Fri, 12 Jan 2018 20:00:38 -0500 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 A8F8715A2; Fri, 12 Jan 2018 17:00:37 -0800 (PST) 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 AE8A33F487; Fri, 12 Jan 2018 17:00:36 -0800 (PST) From: Jeremy Linton To: linux-acpi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, sudeep.holla@arm.com, hanjun.guo@linaro.org, lorenzo.pieralisi@arm.com, rjw@rjwysocki.net, will.deacon@arm.com, catalin.marinas@arm.com, gregkh@linuxfoundation.org, viresh.kumar@linaro.org, mark.rutland@arm.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, jhugo@codeaurora.org, wangxiongfeng2@huawei.com, Jonathan.Zhang@cavium.com, ahs3@redhat.com, Jayachandran.Nair@cavium.com, austinwc@codeaurora.org, lenb@kernel.org, vkilari@codeaurora.org, morten.rasmussen@arm.com, Jeremy Linton Subject: [PATCH v6 01/12] drivers: base: cacheinfo: move cache_setup_of_node() Date: Fri, 12 Jan 2018 18:59:09 -0600 Message-Id: <20180113005920.28658-2-jeremy.linton@arm.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20180113005920.28658-1-jeremy.linton@arm.com> References: <20180113005920.28658-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 farther down in the module without any changes. Signed-off-by: Jeremy Linton --- drivers/base/cacheinfo.c | 80 ++++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 40 deletions(-) -- 2.13.5 diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index 07532d83be0b..a883a213fcd5 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -43,46 +43,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) { @@ -213,6 +173,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; }