From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17C08C433EF for ; Fri, 11 Feb 2022 00:20:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346301AbiBKAUQ (ORCPT ); Thu, 10 Feb 2022 19:20:16 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346272AbiBKAUN (ORCPT ); Thu, 10 Feb 2022 19:20:13 -0500 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E8EFC7 for ; Thu, 10 Feb 2022 16:20:13 -0800 (PST) Received: by mail-io1-xd2b.google.com with SMTP id c188so9527067iof.6 for ; Thu, 10 Feb 2022 16:20:13 -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=hLEL9851jabrdDhcxhGMVE1OmCduEAH/N0L9wmwcIjg=; b=Ddx6yjYcPE8CmX5hCgpAe3NuBPN+UEnDWxaj/S4nyidlsNp29Qi4nO6yKxahYSYWze 60wBTMk/1n3Bf0Dn3Qa+ISIEaGAIbwgzWu13tuLljBfaY2PsnoHzOrV4sBzxPCb9gaGE obvUhv9/uBtVaE78ha7HcUXUC1VXhfiFzo2TuxG/D3nExuOMPflFJuzfwDMEkVz4obqJ U4tJPN3VkTmPOMPDDmKLp4mU6KISHK1gSlamntZK/Ny7CNDDZI5eMEHdTAG8rnsFssRc k94GWNgNxamMatkGjEVqYabjh/Rr7UGcEqRtK2QKFls+yc5KuvRZaVEOKnKvt6NXX9jZ 3Thw== 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=hLEL9851jabrdDhcxhGMVE1OmCduEAH/N0L9wmwcIjg=; b=cXJpWoIZBbcONy8B2Eczqxruovs5zoYUw3lJeExo0OcrCZ02rqfSjEDKH0tcRfyxMY zsFDMnBJzl+w1TkBC4p93GrzjK0FefD5mktb8l2ZH7T/LEn28VF7amGVHC6IAk011nak zU8PB9OGXaA6HlLFlWhSbna5K67Qi+In3K9Z6qLv8PiaJpGJJzuAyLY/9XuQb3ZtOoZ1 NSY2l4hk3nX02gSjGH57hwpGc9ZvXlRAeTqToQm2F7kNPZ3O+DI/a5zuU1+GFmrlcymR DaZL1t/Bg5Uxk70Kfo8R5+U2jsdfv6p7F05Ezcu3hAQARNiIhx6LGtGp8LF7zL7EV34n 60mQ== X-Gm-Message-State: AOAM5338q/Xbd5i/sHjvVa8pmQkIkyE5UJPBSBHBSd68m4+2Fus0hOXN gr2jQc7pYF0B7OhRcm19KmA= X-Google-Smtp-Source: ABdhPJw7qdPMYUQVvRvWAT1whw8GJ3WVabvUcKINgiQx0zHMbH9lOyy7aRlH2DJYa0qShCIMVimymQ== X-Received: by 2002:a6b:7316:: with SMTP id e22mr5135069ioh.125.1644538812801; Thu, 10 Feb 2022 16:20:12 -0800 (PST) Received: from localhost ([12.28.44.171]) by smtp.gmail.com with ESMTPSA id d12sm11665467ilv.42.2022.02.10.16.20.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 16:20:12 -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 40/49] firmware: pcsi: replace cpumask_weight with cpumask_weight_eq Date: Thu, 10 Feb 2022 14:49:24 -0800 Message-Id: <20220210224933.379149-41-yury.norov@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220210224933.379149-1-yury.norov@gmail.com> References: <20220210224933.379149-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 (or can't be) 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.32.0 From mboxrd@z Thu Jan 1 00:00:00 1970 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 EF291C433F5 for ; Fri, 11 Feb 2022 00:21:58 +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=N0OQris6ApFcHk/DVX1ksrHGvOPKj9se3uwSqv2EuZA=; b=wZzLOM1j8EXLwC btu2QifxcA2pUPocyvBYmm0T3DXIXUevT9YdEbGkm1kD8rqzQvzundBU2FLKV2duY3kGvEGSk95ir lZyJrRNDsDAoC43hzHm9xrnJAgAx4M8BaElK1vnr7d2GS1NVKXBJwJLV60F3POAZxFpwD3W4jyvZZ ogMoXXFelLSNgybSOMFid6juDbqLHfYLnHZ1lkPfae25rsQ1vTrBP1eQfWez5xfg3r6gJltz4pOnn DdoZ1ibowHVNuwz6SY9X1KKflac2+xnUDGAaVdJxZrsCxzhDADf1esFpe1jS3Jasyr1uD+ZNnr4X4 FDVPyM+ox60Nw6i3DMhw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nIJfc-005Ika-Qm; Fri, 11 Feb 2022 00:20:17 +0000 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nIJfZ-005Ijx-Ho for linux-arm-kernel@lists.infradead.org; Fri, 11 Feb 2022 00:20:14 +0000 Received: by mail-io1-xd29.google.com with SMTP id c188so9527068iof.6 for ; Thu, 10 Feb 2022 16:20:13 -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=hLEL9851jabrdDhcxhGMVE1OmCduEAH/N0L9wmwcIjg=; b=Ddx6yjYcPE8CmX5hCgpAe3NuBPN+UEnDWxaj/S4nyidlsNp29Qi4nO6yKxahYSYWze 60wBTMk/1n3Bf0Dn3Qa+ISIEaGAIbwgzWu13tuLljBfaY2PsnoHzOrV4sBzxPCb9gaGE obvUhv9/uBtVaE78ha7HcUXUC1VXhfiFzo2TuxG/D3nExuOMPflFJuzfwDMEkVz4obqJ U4tJPN3VkTmPOMPDDmKLp4mU6KISHK1gSlamntZK/Ny7CNDDZI5eMEHdTAG8rnsFssRc k94GWNgNxamMatkGjEVqYabjh/Rr7UGcEqRtK2QKFls+yc5KuvRZaVEOKnKvt6NXX9jZ 3Thw== 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=hLEL9851jabrdDhcxhGMVE1OmCduEAH/N0L9wmwcIjg=; b=ku+jmVj+UK60c+BC+sh84IZ05Vcfk/AIiW3G2KQN2RzFrQIGIDktBXvdi+baffmn5Z LYJHZnZCYa/OviXBLbOZ50WsxXRvirI3VFdsiC3Zd5aeVPdLh8safqTnqSkU+fYtikqr RjyUMeLhIY1VCZCTX6I+RVoncRH5S7ZDVGLgJFCw/q36+7guj1g4gsJKsbmL9kVcX1qV lXSDHBfitkM2+WHJsq7B/bCEdbuIwGpWf5IaYIx1tJdsVdnBIo4hXxUGS6AJtGgvMye7 j9Noc37SjJk4Vb9v+mBsrTeELVvEIg9B3K5jYqbAjoC14dGmNTf5+Bjpde/hdMAAK3pJ SywQ== X-Gm-Message-State: AOAM531Y7HyhHytAwxokZZMrGZNZ2sxUQfL/TYgbxUVT7AikQX6SO+8x rmoHyD7RYWlAqlPqXrfj3uY= X-Google-Smtp-Source: ABdhPJw7qdPMYUQVvRvWAT1whw8GJ3WVabvUcKINgiQx0zHMbH9lOyy7aRlH2DJYa0qShCIMVimymQ== X-Received: by 2002:a6b:7316:: with SMTP id e22mr5135069ioh.125.1644538812801; Thu, 10 Feb 2022 16:20:12 -0800 (PST) Received: from localhost ([12.28.44.171]) by smtp.gmail.com with ESMTPSA id d12sm11665467ilv.42.2022.02.10.16.20.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 16:20:12 -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 40/49] firmware: pcsi: replace cpumask_weight with cpumask_weight_eq Date: Thu, 10 Feb 2022 14:49:24 -0800 Message-Id: <20220210224933.379149-41-yury.norov@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220210224933.379149-1-yury.norov@gmail.com> References: <20220210224933.379149-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-20220210_162013_627186_986E4AA5 X-CRM114-Status: GOOD ( 13.15 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 (or can't be) 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.32.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel