From patchwork Sun Jan 23 18:39:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12721090 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 36EDAC433FE for ; Sun, 23 Jan 2022 18:43:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BXQ8eBxtHQVIg/6Kp8U5Q2Vbb+UhpAMAL/trgaiZwuQ=; b=YaMtWsD6GvA4Ud kwTQijKNLxP75BVXBHI2aLaVHka56jN/FQW6vx3hrcw6JcHvJ86tbTjpxcBLmuphiFMg/CjgwuvxH MfCPimIrpPMUKerd1lJicXzfQPWNpEVF+gj7ecN3SYnFOOttbp7U6ZMK4vlBdrsbnkeTmPDfRbAMQ foD8pmT1VLjYEBGgSF519xm5jA3u7M60XIiflM6w9xpYYBZ1AL1zmrI5q/n6YHxxVTB/TLHjUs9QP UYHzbpYyyI2cy2U7qJNrscrOfSa0SOnueh0ybMEjMu2El86tRnr4QpJOOBdFLULK6pDQSpCLqpd3p Wamry3kCZqSH5JIITxcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nBhoR-001Zsr-Ui; Sun, 23 Jan 2022 18:42:04 +0000 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nBhoO-001Zqw-OS for linux-arm-kernel@lists.infradead.org; Sun, 23 Jan 2022 18:42:02 +0000 Received: by mail-pj1-x1031.google.com with SMTP id pf13so14154198pjb.0 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=h3Q03h1OEG8U/5FKM46xRPolNsh1z1cluIGQZ64i70Io/8S86VwIoeSULAb1C9xG59 vya3KM8fbXdcD6HYX6S5ZXRjtyg7AMq3+aEvZQ35ujJIBZAV1vGtVIiVMsM4Y06Itgja POpBqJc1Y+4Nmyvu+xDBTTlpmOvq4qc0Zt/Tte0Wp+x9Y66qMEuKFUM0DxkDMu22//V2 Mh3B3dEFtuY4RAGZSqRGhQbfQjI+7W8mSZQE6gOr1pV6agwYwQT/Ew4pzB2eTiHTrG+l oIuC8GRSNk+m03QkAMUdbNjGq9ihj3B4YnJV2uHA40MmKhiSPTYoaOk6tCkLmZ11Ufrw azsQ== X-Gm-Message-State: AOAM531oXk0tflTnFFTwjTtBUjUrkDBc0PdEkgD16Pc9FzOTOzyidsN3 eA2kM7yHYZO+E4RF93Uw1NE= X-Google-Smtp-Source: ABdhPJyKnDsoQFq8L/+C1ePy3bLtIDZz3wYrVC6GemjQIHFlwG9Gr4xw7tsDXE/Qezv8iRphFZXolQ== 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?b?TWljaGHFgiBNaXJvc8WC?= =?utf-8?b?YXc=?= , 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220123_104200_821484_779977ED X-CRM114-Status: GOOD ( 12.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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",