Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5860834ioo; Wed, 1 Jun 2022 14:19:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwA2t1i9/tzHtbxgpi3r+sD4cjgvSsgV5CSvYfV1D9xnE3RWegU5LQ2HQhHNU+QWZJfy2kE X-Received: by 2002:a63:fc5e:0:b0:3db:5804:f3b with SMTP id r30-20020a63fc5e000000b003db58040f3bmr1185574pgk.126.1654118374402; Wed, 01 Jun 2022 14:19:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654118374; cv=none; d=google.com; s=arc-20160816; b=AtF1CmF4MTJzWbH+8PV0q1BTxzO0qh5zOlToRFBMEDhtkAIjvqtEo6PDNXSRvbkoQt irbGNULyy89tK97l/ieUPDmwT7/oDQkccSiyO54J1jcmG0fmKh5bmvEfvg5zq+SQ4FWp 2cyVskwjq6UtdiMiu6/o1FsjHFYhb4oNqF2jJ5CCG8fBqxbKlAC2tfXEuOhvHy99x6rR 8r10SjqKy4drDSKUQkMMeBK/OQBYw+PRjMTfJaTMaYuKkxaw08eghkxZBpjfeGDHCu4O PjCJb3bOPWJ0Cs3eAIBg2by0zWegYxz53QIYo4aBcqzYzvjMPJ6zXuZKG85Xws+VO1ev S0bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:reply-to:dkim-signature; bh=jwDnrFd7uXmUoAYEBuzB/Z1dpZnq4v5IwtowuAg3PDA=; b=NpfUc3rODIHs4Rl7bMNQu7f0IT/P2mgJG/JKgs0toq89mUIkDDEl4DztkXbj6KlXxS Lgmg8Pu+vx+lt/BLXFm7GrNBfTaUo7TY2UnSLUkLzaJHzWNdccXBsTk1qGSSrmjVDrin dOfy7t1KlBf41b4J7nz8QkZOLbDe93rpgyDY4TwYpwEsUIuaavvJrAlgCOsaHLkpKz0i 18T1AgSCP8YHhJH+X3Fw/PJz9b0NR/VTiNtOiuCNClhJ7Uf/gLPtb9vgXWqcEFjz9hHT ZDe+oxNosyufZaZnlJbErh/5fb8E0X+RcMhNLFnAuVtxsMubyWXIAMdqHBk2/6fZJrQc Iflg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="M/FPx1DQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c8-20020a170902aa4800b00156966c019bsi3364367plr.537.2022.06.01.14.19.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 14:19:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="M/FPx1DQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BB50723B547; Wed, 1 Jun 2022 13:10:44 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235818AbiFACpY (ORCPT + 99 others); Tue, 31 May 2022 22:45:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233771AbiFACpV (ORCPT ); Tue, 31 May 2022 22:45:21 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 449B15AA56 for ; Tue, 31 May 2022 19:45:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654051519; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jwDnrFd7uXmUoAYEBuzB/Z1dpZnq4v5IwtowuAg3PDA=; b=M/FPx1DQp7vj0YARnV2kg+U22p3WotBDmaop/O6sKvMEuu069a+rZOloAUwwj+8vXCSJQ1 MaI4CdXZwGPedJP+ip44W5vysBjluSrUhQuxF6yKfD4HSNaJjNZ4vYGvMTAoVWWHLTdrum l9IxNHSZAYpyAkamA5NZZvTLfTjfAQE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-111-djZtqZtiOnW-x7e8J32zNQ-1; Tue, 31 May 2022 22:45:13 -0400 X-MC-Unique: djZtqZtiOnW-x7e8J32zNQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2A45E811E7A; Wed, 1 Jun 2022 02:45:09 +0000 (UTC) Received: from [10.72.12.91] (ovpn-12-91.pek2.redhat.com [10.72.12.91]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 25F96C15E72; Wed, 1 Jun 2022 02:45:03 +0000 (UTC) Reply-To: Gavin Shan Subject: Re: [PATCH v3 01/16] cacheinfo: Use of_cpu_device_node_get instead cpu_dev->of_node To: Sudeep Holla , linux-kernel@vger.kernel.org Cc: 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 References: <20220525081416.3306043-1-sudeep.holla@arm.com> <20220525081416.3306043-2-sudeep.holla@arm.com> From: Gavin Shan Message-ID: <42bb2efe-e28c-fd15-d00e-8f45dc24b0d1@redhat.com> Date: Wed, 1 Jun 2022 10:45:00 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <20220525081416.3306043-2-sudeep.holla@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On 5/25/22 4:14 PM, Sudeep Holla wrote: > 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(-) > Reviewed-by: Gavin Shan > 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; >