Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp6008imw; Mon, 4 Jul 2022 04:17:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u1lDGVufKMzjrzz0wIpyIBMQJKuW/uux0UNEoIkNwVs1m910CCQgo9+QefUW82R2r/+oea X-Received: by 2002:aa7:c14f:0:b0:435:7b75:fd06 with SMTP id r15-20020aa7c14f000000b004357b75fd06mr38223975edp.352.1656933477488; Mon, 04 Jul 2022 04:17:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656933477; cv=none; d=google.com; s=arc-20160816; b=fibg3pUIoJ+ZVMlBTuYTz4xC2YKrJoFY8lNNiceXGpyF72Mms4P1ETyTmNUfiQ46A8 oE/eq5yHz0ObY1rLaZqfCatPkVh3Y+QhiAjz1+fRlHXVt/IlbfxlH2KH98rZVrJ8T2/L 7lVCAbjU6wwGQBibsZkfTRojOOqLIIZ/TMpUmMqWhvYOuQLGWnHBsGb+0sF3Cr7icgKJ 3EkSEGz36QcUAvu/Vh5xu3117gbDOR/ZsWvjy69WHsgZ0RBG+jGgB6+iA5G3RvDCyf9A 0wuro95si8RbeBADomuqCWhGvNq/UbevbK4q9nDnJVk8LaFfo9e4Qi9arDko2FR81gf2 swzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=xUQhceIY8c23Ox/ip5rIQL//rQqSz2g45yQeBOuEOTI=; b=JUCdFSNLpG4VbASuCg4Vp/MXWHd+Oz4xBY4WZhxxN+xowYrFIvh8NPov3oayZq7A2X YS2ZtgWzTAry4EbA5pVdT7mX039GpMkhbtra7rkxWbY2U6lft6Y9II7ur4QuM0pcgOCD 85U8G7UqjJNWJuQiHLyx4f+Yer4kf9dRLNIYrlX4sWFn0ULWjkN2CpizIOdTMbVC5UFB ADYi16hm7dWTtsGxyS9N33eBOdB8KjYzmpj+dHU2seS1iaIPBBbkHLoY8nmP8Ca/gFVh G02OcKSZu//ajK3y5akMeysQQcLlXVvUdTDmDrhSS/OTkkVZgq76dRav+k33uBAAMfUX ENIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s12-20020a1709064d8c00b007262c36fb83si6286936eju.561.2022.07.04.04.17.31; Mon, 04 Jul 2022 04:17:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234295AbiGDKQ5 (ORCPT + 99 others); Mon, 4 Jul 2022 06:16:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233425AbiGDKQW (ORCPT ); Mon, 4 Jul 2022 06:16:22 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 94C8FDEE4 for ; Mon, 4 Jul 2022 03:16:19 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A64231480; Mon, 4 Jul 2022 03:16:19 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7A9D03F792; Mon, 4 Jul 2022 03:16:17 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, Greg Kroah-Hartman Cc: Sudeep Holla , conor.dooley@microchip.com, valentina.fernandezalanis@microchip.com, Vincent Guittot , Dietmar Eggemann , Qing Wang , Rob Herring , "Rafael J . Wysocki" , Ionela Voinescu , Pierre Gondois , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, Gavin Shan Subject: [PATCH v6 02/21] cacheinfo: Use of_cpu_device_node_get instead cpu_dev->of_node Date: Mon, 4 Jul 2022 11:15:46 +0100 Message-Id: <20220704101605.1318280-3-sudeep.holla@arm.com> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220704101605.1318280-1-sudeep.holla@arm.com> References: <20220704101605.1318280-1-sudeep.holla@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The of_cpu_device_node_get takes care of fetching the CPU'd device node either from cached cpu_dev->of_node if cpu_dev is initialised or uses of_get_cpu_node to parse and fetch node if cpu_dev isn't available yet. Just use of_cpu_device_node_get instead of getting the cpu device first and then using cpu_dev->of_node for two reasons: 1. There is no other use of cpu_dev and can be simplified 2. It enabled the use detect_cache_attributes and hence cache_setup_of_node much earlier before the CPUs are registered as devices. Tested-by: Ionela Voinescu Reviewed-by: Gavin Shan Signed-off-by: Sudeep Holla --- drivers/base/cacheinfo.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index dad296229161..b0bde272e2ae 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include @@ -157,7 +157,6 @@ 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; @@ -166,11 +165,7 @@ static int cache_setup_of_node(unsigned int cpu) return 0; } - if (!cpu_dev) { - pr_err("No cpu device for CPU %d\n", cpu); - return -ENODEV; - } - np = cpu_dev->of_node; + np = of_cpu_device_node_get(cpu); if (!np) { pr_err("Failed to find cpu%d device node\n", cpu); return -ENOENT; -- 2.37.0