Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4137675iog; Tue, 21 Jun 2022 12:52:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1utsPg43ZoUYIU/1IGVMIlbE5PcjTQEBg5We8dnj8HSlOPApqspsojdETVkSNGHVfREO18L X-Received: by 2002:a17:903:1c7:b0:16a:2762:88d1 with SMTP id e7-20020a17090301c700b0016a276288d1mr11148494plh.76.1655841156610; Tue, 21 Jun 2022 12:52:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655841156; cv=none; d=google.com; s=arc-20160816; b=HtubtTTeS6y2HtQgdG2wF7ezmpzmibgbB0ve1DDndvAlBJdD+Ddr2KzwE7yjODzqa7 6XPEFWUW+pQac3n9M+VJtq5V34UKZcqIhAaakj6vIpLd8LCUNvWVrc2HmIpfjiszrkB+ JMb6Kkeac0duAkwGW1qRFTMEBrdr3a9kjsp1tEUW9Z9th8TJ87/a8oO+anFbNZ6L6me9 GNyhMzUWmosIzX5XQJ+mn/a4XCqv8Thvtf2I+r9TowLZkW7PFG/QppVXjh4NmQbAqLMM OO2uPtEXQVehksLdr2M7zxwEKQ0cbpAr908vIkgefw5NpeuniUr+sDSCKjHPfHSy9S1e PfQA== 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=UfnFI8kpRMaISVadzRSV7Mwdj/xUhVUm5K1NOmTRaUQ=; b=fWiar2ob8+f0bAHFnZOoa1G513W7al+zB/WMDx6S3oM6mu8TBxdw2n9f7+auIYOgth B1unOnl/D+VCFZUM+1HtIHb2FwM1umEyN4mV3DgBeZ3o7MnBZDyMW+9meRUUGsUHkF9e V2pkRzPY0Wp9gq/OUWFdGDdv3Zt/2cfIjISzTxxTrSNFuTaiMNVNemgFroVt1khUnPyZ G9KDwS9FuC7AhFioFoF+avrka30dLSOBFG2CfOV5h1W7AYoz9ATvEe9CY+ckxkol4iKB km+3k5i5ycQLcBbfFNiRRgdq1rRFn3kGmBdSWxhLoAAE2dcAl7CF79oUfEkIqsgLhnn3 tl0w== 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 x18-20020a634a12000000b0040c696a0d98si11991138pga.379.2022.06.21.12.52.23; Tue, 21 Jun 2022 12:52:36 -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 S1353258AbiFUTU7 (ORCPT + 99 others); Tue, 21 Jun 2022 15:20:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352447AbiFUTUv (ORCPT ); Tue, 21 Jun 2022 15:20:51 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 75BB427B for ; Tue, 21 Jun 2022 12:20:50 -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 6B4D9168F; Tue, 21 Jun 2022 12:20:50 -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 62B853F792; Tue, 21 Jun 2022 12:20:48 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, Greg KH Cc: Sudeep Holla , Atish Patra , Atish Patra , 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 v4 02/20] cacheinfo: Use of_cpu_device_node_get instead cpu_dev->of_node Date: Tue, 21 Jun 2022 20:20:16 +0100 Message-Id: <20220621192034.3332546-3-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621192034.3332546-1-sudeep.holla@arm.com> References: <20220621192034.3332546-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. 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.36.1