Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4169532ioo; Wed, 25 May 2022 17:13:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyI/EWo/ombqK11D6aiH/2bWzRmvoTsev+7Eay8PlBBR6+yXHcehDijEIlp9+YZglWjZwGe X-Received: by 2002:a17:907:3d8a:b0:6ff:a9a:bea7 with SMTP id he10-20020a1709073d8a00b006ff0a9abea7mr7727692ejc.134.1653523994098; Wed, 25 May 2022 17:13:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653523994; cv=none; d=google.com; s=arc-20160816; b=yNZjudAC2MHLYSkIsQsa7tEfEWIRKwrWwWb9DtgTbsia85p4I1lZAkZGiuqfEx/tlI CYLTvNC2DdNLZh0r3l6CLFaCaoHwiNh06nokq8HJ5geLInEFGjbgor1Es7Pv7FYE2FdA ivYdHpzmmvdegPvpVSIm3byHVPHM/3qfAAPtJ63thpSqJa4CDEaBfBpqICHBD1JKxbwS 05KuySwxuReF4MGZ+mYc0DuORCY4mMuA1cyG0wrUuCHvfeWGeMZ4hmwpeSxQSI2DegoS eZB9seY6W2+3uHm1pzD73hIxeypIOq9rkFxZgmeEcRe2CM0/wUzuiBfaHyPs4OgrsJ8g BCKg== 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=3jLyYt4qcM9baKmd6Bg1mvo4vaQslWJhomR02m/AJnI=; b=n0zwRFyQgQ16vW9NYk18npicOjTIR6oRzFtHkMj7V+mKthZXsxDhIftP5Z7JiCkL+2 plw4MU4+M3hbvqag4FC+YEsFP4KXB3aziUtbhtlGDWdnh24RNJmeO2Z0pFLm8dh3PXXb rTw8GIhXNQg/9l1vGA+RN3TBxIFRH+adLqlaloCn2JGClNd02TTxcyFiEL1FeEab8+bu 11PNjxzLDO0bDlHpKMrZ/DXHXaeEIvl1KR8HhUEdAkBBog9mdreOANeiIXkmsZ7I9UTC Tj5WZx8MJPEoHH3b0JxtRhaL+dI0hf/NA1evff4qX+emiZXp0lT6hj6L32JcCQ+T9FQr My5w== 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 ji1-20020a170907980100b006e8bbf3d88fsi169504ejc.15.2022.05.25.17.12.34; Wed, 25 May 2022 17:13:14 -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 S236747AbiEYIOn (ORCPT + 99 others); Wed, 25 May 2022 04:14:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235848AbiEYIOf (ORCPT ); Wed, 25 May 2022 04:14:35 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3E6ED7C158 for ; Wed, 25 May 2022 01:14:34 -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 F1FBC23A; Wed, 25 May 2022 01:14:33 -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 E41F03F73D; Wed, 25 May 2022 01:14:31 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Atish Patra , Atish Patra , Vincent Guittot , Morten Rasmussen , Dietmar Eggemann , Qing Wang , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, Rob Herring Subject: [PATCH v3 01/16] cacheinfo: Use of_cpu_device_node_get instead cpu_dev->of_node Date: Wed, 25 May 2022 09:14:01 +0100 Message-Id: <20220525081416.3306043-2-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220525081416.3306043-1-sudeep.holla@arm.com> References: <20220525081416.3306043-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_PASS,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. 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