Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3176210pxb; Mon, 24 Jan 2022 04:15:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJzhvWH3JUQnpCDlHLV9DM3gPDdpLSG0dJIc6gbOBgxyz6wsQCmrYGqk4omW1++zHyVrGqjw X-Received: by 2002:a05:6a00:2306:b0:4ca:1057:7072 with SMTP id h6-20020a056a00230600b004ca10577072mr1231215pfh.16.1643026547548; Mon, 24 Jan 2022 04:15:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643026547; cv=none; d=google.com; s=arc-20160816; b=wJdTzhocU2Y9f2/wNLlSnSSnHDVESMiXLLlZqGshf/VdF9H3885zlvgMNSESo3+TT8 l5FHYaWx9LEPdCEHiPAckbFP1KAa4ei0uRdON8TkP8rkV/cPe8cWCdw6CFM5lNFFTmGq 12Um0Ksxz/VdfN0ReOjxHxGm6UrgASvqf69Mo7j3hYo6WLSQJSGGc4fv0CNUCNjr+mKy eZKTC5Trnf/Xxzjd+OTbmbgsLG1/WqVvHtu6w6KgW3g2a+hey+B/5V75KTlL0X9nULvQ 8d1b52y9IHsn81gL5clyATjYDVFM2SRmQbu0xj1M3ppq80NDDeTS7MkNE9ZW3GGy6DU+ vgAQ== 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:to:from :dkim-signature; bh=SXSPpkBNjFI2449vR4ZOBpkrXqfQ1QSZDhxzDBOLdyY=; b=UAGe7POVz0K9wItBYf2x3qq6bAl7TAkz/9XEUaof++gT0NEnzzqigvGNLb3t/fCSZX oo6wu3M4m0QdZ4o3Ez4WXnU1IPyQ4m3XpLz2j/H/vbG2yA8qYCk/LEUopEIDFtYfYYl+ xKTcnyuc16pOIUNfXaYMqvwdxy/9qDL2f7ghcaKlW9/e2H6dnIA+dyxzPRdbGB+yROdk +qmZSfOHnf+VENpPYvadkVotC/bTvMsG7esBfchjD/69OXFlQW8bcEJkOw6mtwsUcija zDK6dboYlaaBnbj9i223QcIm2OaXb1oxpNnI1iIgWR7a5FFcQz3OLV010lJrThum7oeg qKzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="eiPAXI/W"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fz3si5173827pjb.46.2022.01.24.04.15.35; Mon, 24 Jan 2022 04:15:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="eiPAXI/W"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234753AbiAWSnG (ORCPT + 99 others); Sun, 23 Jan 2022 13:43:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239775AbiAWSmA (ORCPT ); Sun, 23 Jan 2022 13:42:00 -0500 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37B0DC061755 for ; Sun, 23 Jan 2022 10:42:00 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id d5so11712781pjk.5 for ; Sun, 23 Jan 2022 10:42:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=SXSPpkBNjFI2449vR4ZOBpkrXqfQ1QSZDhxzDBOLdyY=; b=eiPAXI/WjLAblkhca2uJhe8/W1CRBsKo7ESuVXB0ckdjmDbHwcwgeLa2vXoJEA0fxt Lk59qbjVjcrnZW1unyX5auKxG1xSZWfPJLHePY7jbbfw6OU/1dAOiaW9oqdl3dEpJ3Xn sakgCeMBvaAp3NPshZro4hIL2pKSOLMTNpsTpVv9/0QG/GJwtcdeptM9Yq4T2QuU6dXK UTfY8b5LygRS843t6y5kmY8IYWkURJI+hhQfQcy71BSS5so3P9u58xxmG18sNMn9oYSq pafGE5mVfB/hgq0mIoQ+ZMVlM2mnFF+ic2R7UXat+e/IHhEQ+9l8LdM2qfjQ5lJdjt7W AaWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SXSPpkBNjFI2449vR4ZOBpkrXqfQ1QSZDhxzDBOLdyY=; b=us95joowT3/ZtECP6SY0PY4wZ/iwTQp403UNTlhLuPQ0d8z1qbpQ7jv4N5EeQlO6Ra dgYJqU39xUPAZtqV04A58V/se+jJXe6OjUmQIxknvU9n4O6fdU8LfqgLdd6nDHAPX8qo AoHsYKuSZWQ1PLqe6SNZjIhETUa6HEhgIN1LXG81Gv3sBOBhjxeszaM0K3OP6rlEH4No j1l2rNI/qoDVFn1WeTdzqK4eS/I4Bp6VCRuRpCgJ/HyAzTHABBqhhoejRhu0Xaild8U4 9NuBYyKc2YvJnFq+FeOgdPYkXJ4hSsne6kl3xP3HMjsQqOeFoVy79Xga6eZ/SgepxhPG o5Yg== X-Gm-Message-State: AOAM532rmazHEXhmTlJ/yLYJnd68R/T6r6eiGLpQsY5LaGUBHYGkZApH Zi7AyTAs7BkpDVLD2qfhm/Q= X-Received: by 2002:a17:90a:8807:: with SMTP id s7mr9725127pjn.223.1642963319695; Sun, 23 Jan 2022 10:41:59 -0800 (PST) Received: from localhost (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id mi6sm12051532pjb.40.2022.01.23.10.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 10:41:59 -0800 (PST) From: Yury Norov To: Yury Norov , Andy Shevchenko , Rasmus Villemoes , Andrew Morton , =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= , Greg Kroah-Hartman , Peter Zijlstra , David Laight , Joe Perches , Dennis Zhou , Emil Renner Berthing , Nicholas Piggin , Matti Vaittinen , Alexey Klimov , linux-kernel@vger.kernel.org, Mark Rutland , Lorenzo Pieralisi , linux-arm-kernel@lists.infradead.org Subject: [PATCH 42/54] firmware: pcsi: replace cpumask_weight with cpumask_weight_eq Date: Sun, 23 Jan 2022 10:39:13 -0800 Message-Id: <20220123183925.1052919-43-yury.norov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220123183925.1052919-1-yury.norov@gmail.com> References: <20220123183925.1052919-1-yury.norov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org down_and_up_cpus() calls cpumask_weight() to compare the weight of cpumask with a given number. We can do it more efficiently with cpumask_weight_{eq, ...} because conditional cpumask_weight may stop traversing the cpumask earlier, as soon as condition is met. Signed-off-by: Yury Norov --- drivers/firmware/psci/psci_checker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/psci/psci_checker.c b/drivers/firmware/psci/psci_checker.c index 116eb465cdb4..90c9473832a9 100644 --- a/drivers/firmware/psci/psci_checker.c +++ b/drivers/firmware/psci/psci_checker.c @@ -90,7 +90,7 @@ static unsigned int down_and_up_cpus(const struct cpumask *cpus, * cpu_down() checks the number of online CPUs before the TOS * resident CPU. */ - if (cpumask_weight(offlined_cpus) + 1 == nb_available_cpus) { + if (cpumask_weight_eq(offlined_cpus, nb_available_cpus - 1)) { if (ret != -EBUSY) { pr_err("Unexpected return code %d while trying " "to power down last online CPU %d\n", -- 2.30.2