Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3136840iog; Mon, 27 Jun 2022 09:53:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uzVXW3CQkJ7CZ/P7pLnIIkzPdPAHLpwkf9+Tc1r322WZ85up3KNEF/d23BgJ/wro4hMAGG X-Received: by 2002:a05:6a00:15c1:b0:525:2db4:2a2c with SMTP id o1-20020a056a0015c100b005252db42a2cmr15647083pfu.30.1656348798155; Mon, 27 Jun 2022 09:53:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656348798; cv=none; d=google.com; s=arc-20160816; b=FViGmVlz3sjiqE/JBMGwoYHbjai15xDwdI7XKOsRLygMTdvw5kl18/gw1qNmv8l2Er OdTBXTiUvflSZJiw7SgIIxy8DKr6HlJ3D+CfmtZExaTLfRP9LR+9zvm6EvTMwBmP3BVi CDMXwfeMWopWSQlCsGml0xvif8a0wBIFkZ7hD/txXVb30LnzDtTdmo1fEdjPZBPKfNgA Z7xlL0WUUj7rcooTVwUC47L8bwkmSAyCYYzc23+yAc38o6TR6aWOM6ZyegUi2GHeYOUk 4oxMSqUE1sqQVSd4wn32VqzujlwO3dXPiK5iQL339mrgupSwsOR/GDx/S93MYAhkSRlW 34bQ== 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=TwGBKheVBi5UiAtNr3jPLP/bYJu+EmzSKGCiag8JRrI=; b=Jz2sCw1cFUspoMZEut5BlTPcRLJEWj6jXRWRyvxyQmjVJvHf2jzDYpytsfN8DtOLS9 hx0GHGgMK2vmF2VG9/3rHJ1AGsRxO9n+EMXL2xQmID5IMFRf7dbibfQKO4kIGM5m78nj W9i3pCfmyEKOSRhB8eQSZBEXEsXvqSaJgp46oJmSKGNlQylGSOlPATTJm/WfeRcIvq2W oQ9ws3Rd4/H9JQ5u9DzzoQKMd7sLxhWA62t66UkD3VwJEYrJUNM7xmtf5l0AhlJ6IIMV 9G/R2YA0Om4d1vvFF+WNtW3wG+yNFQUw2QpRt4mr21XUnDctwDIYRY6kl17reUVMLtRl Xtkg== 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 i16-20020a170902c95000b0016a4e6944c9si1625955pla.146.2022.06.27.09.53.03; Mon, 27 Jun 2022 09:53:18 -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 S239437AbiF0QvI (ORCPT + 99 others); Mon, 27 Jun 2022 12:51:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239426AbiF0QvC (ORCPT ); Mon, 27 Jun 2022 12:51:02 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F32D110FF5 for ; Mon, 27 Jun 2022 09:51:01 -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 F35021762; Mon, 27 Jun 2022 09:51:01 -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 02BAF3F792; Mon, 27 Jun 2022 09:50:59 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Greg Kroah-Hartman , 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 v5 02/19] cacheinfo: Use of_cpu_device_node_get instead cpu_dev->of_node Date: Mon, 27 Jun 2022 17:50:30 +0100 Message-Id: <20220627165047.336669-3-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627165047.336669-1-sudeep.holla@arm.com> References: <20220627165047.336669-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. Link: https://lore.kernel.org/r/20220621192034.3332546-3-sudeep.holla@arm.com 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.36.1