Received: by 2002:ac0:de83:0:0:0:0:0 with SMTP id b3csp1446984imk; Mon, 4 Jul 2022 03:19:04 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vZjKSYFnNK//21D12hI8k7ZIDqKW6kwFZs4AyxXRODo9gFmD1Y56EHiNwMx9R6MozNHZmt X-Received: by 2002:a17:90b:388b:b0:1ed:406:492c with SMTP id mu11-20020a17090b388b00b001ed0406492cmr35156877pjb.31.1656929943951; Mon, 04 Jul 2022 03:19:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656929943; cv=none; d=google.com; s=arc-20160816; b=iLclnj6p5hdq8kS3JUjp8dPSoeRxiWkl2xOJWk58KfVQn4TiFpFpYHc8Pfop8BMDtZ tyjF4dJL1CORERcslHfxONX3841JqT5oKP6CIYvsx+7gziUIk7hMYLXN0PMYfbhkHXag 3/faAoj58UKUjotIrotMMrvLunsB1Ame+vsHte6ov875dx6qLxKMd0L4yzkvNmdof4ip JBGYQtwgPI4w/U/91HVhrVC0+M/6CJXnD2+P4kgKYJ2mcx9agA0I9XccQz7AC8oaNIcg 2p5+sge0WUGlLT6KjX/D+naXLmqdUxmqjk76Pw6H1th0Yhk2Nuz2R5i4pcRk4vnELL9J 2xOA== 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=bGy88FmfC3WmzHNtLWlVejqTDb0eap9L+xOrZe+IyDc=; b=frT8nnoLr23XDNqaiZmmkij9E31ZAxtockNqG3uMwc/iMlUG8i+ysHUA8zARYqPlbm a4RCzXMKE7i+AcutEgZlVU5RifikZtuTB1Hup7BfzhuD5kk0Vtsjt5ksDSI3A/8WqFNn uXYd3Wo4c2g15aLz/wtgGayORHYTjj6DdaeWQ9mdonbPiKoFpxrGxiM4jR3wc8wnxpc8 L+3zTVb/G8dzHYCrBHi+A2JPdZThyFqC+JWCjsw9iHC+8HoTouU0WL5w2LLuBHoB9U4G Ao249FhK2s/kyMZGx1nxUw8Qj/LqYeuZJQ1wO1NyFbJ47vngcCBr4UGI8rGMmPu8/fC3 0pgA== 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 d14-20020a170903230e00b00163a83d160asi13080241plh.168.2022.07.04.03.18.52; Mon, 04 Jul 2022 03:19:03 -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 S231135AbiGDKRZ (ORCPT + 99 others); Mon, 4 Jul 2022 06:17:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233139AbiGDKQc (ORCPT ); Mon, 4 Jul 2022 06:16:32 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D81B8DFA6 for ; Mon, 4 Jul 2022 03:16:31 -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 F17571480; Mon, 4 Jul 2022 03:16:31 -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 E16A73F792; Mon, 4 Jul 2022 03:16:29 -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 Subject: [PATCH v6 08/21] cacheinfo: Align checks in cache_shared_cpu_map_{setup,remove} for readability Date: Mon, 4 Jul 2022 11:15:52 +0100 Message-Id: <20220704101605.1318280-9-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 checks to skip the CPU itself or no cacheinfo case are implemented bit differently though the effect is exactly same. Just align the implementation in both cache_shared_cpu_map_{setup,remove} just for improved readability. No functional change. Signed-off-by: Sudeep Holla --- drivers/base/cacheinfo.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index e331b399adeb..65d566ff24c4 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -279,6 +279,7 @@ static int cache_shared_cpu_map_setup(unsigned int cpu) if (i == cpu || !sib_cpu_ci->info_list) continue;/* skip if itself or no cacheinfo */ + sib_leaf = per_cpu_cacheinfo_idx(i, index); if (cache_leaves_are_shared(this_leaf, sib_leaf)) { cpumask_set_cpu(cpu, &sib_leaf->shared_cpu_map); @@ -301,14 +302,11 @@ static void cache_shared_cpu_map_remove(unsigned int cpu) for (index = 0; index < cache_leaves(cpu); index++) { this_leaf = per_cpu_cacheinfo_idx(cpu, index); for_each_cpu(sibling, &this_leaf->shared_cpu_map) { - struct cpu_cacheinfo *sib_cpu_ci; - - if (sibling == cpu) /* skip itself */ - continue; + struct cpu_cacheinfo *sib_cpu_ci = + get_cpu_cacheinfo(sibling); - sib_cpu_ci = get_cpu_cacheinfo(sibling); - if (!sib_cpu_ci->info_list) - continue; + if (sibling == cpu || !sib_cpu_ci->info_list) + continue;/* skip if itself or no cacheinfo */ sib_leaf = per_cpu_cacheinfo_idx(sibling, index); cpumask_clear_cpu(cpu, &sib_leaf->shared_cpu_map); -- 2.37.0