From patchwork Sun Jan 23 18:38:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12721095 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 CED45C433FE for ; Sun, 23 Jan 2022 18:41:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239788AbiAWSlP (ORCPT ); Sun, 23 Jan 2022 13:41:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239780AbiAWSkw (ORCPT ); Sun, 23 Jan 2022 13:40:52 -0500 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DE56C061759; Sun, 23 Jan 2022 10:40:48 -0800 (PST) Received: by mail-pl1-x62c.google.com with SMTP id n8so13502444plc.3; Sun, 23 Jan 2022 10:40:48 -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=cO0Z3PvJvrtBIn6aCGpasZToGZcZBgiQnRAFqmRKoUA=; b=VTMY+YdRuNkseAuKEB0sacTZvHBgfmV4zPDgBlUHO02zbXakt4ftdzjgYgBnhNFYrJ Gq/uz/GbVuYEBJ11Si9b0Vn28HMi/mKcmODrHWStsvvykUL1wKNDqrObs/faG5tjJnMP OFcvcKedlRAfcJ0JntIkaDRTuDhuOwUp6/XHLbkcuMjlet0EBexHnDi/ng57aRf/xLdn 1R/z7KVKOdfOw/cNFfqJCxm+KwLQZH3lH+oCNAjmxn67gPX35JUauw2ASaBtUHJW84ui 7X7hf94iixk6ny58oeNC4S0XBdNtjpDuPJIvRp+WVBgHJCoL0Ieo81r93udRPOdgTwY0 3e3Q== 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=cO0Z3PvJvrtBIn6aCGpasZToGZcZBgiQnRAFqmRKoUA=; b=G9OX+MsPW8hB9aTVfrhDYWPI/3f6yU6LtHjJq+HMEgedto9yeYfnXcbcrdHqwmwuLj r9j36Xn/Qu09sW9CL9RRMfbA3VlfDHuVUilmdqHojmBqsqgrV8BZJ/SVdHEq+aVM2hm8 oNWzOZ206W9iEv4EwqirKTUkihIDoMA8EqG/bbhai/lJuD243z9BJs+o6L4834YXIrc6 aH+3aLDckl+ou5mr2KBEa2SRFprBz+mPrGR4Bs2HMnNQ+WJj+EXsIu8rTpXFlkC+sywC AQ5ko7/iIgBT+EVXAWoFoeK5d5s8pCtaB9RL5B9iNZzNTPfZhEspfmcNy7NQFvpHD2ic cOqQ== X-Gm-Message-State: AOAM532CSSVdJpNxlb3Tcr2DoCQqz8o/AiuecbJo/GcnNePMIGFJLDX1 BsdXpupwTvnC9E6XhnartrI= X-Google-Smtp-Source: ABdhPJwrgZ6tKrcQ8FvcUHvDuVXP9x3ixqRStUB6a92ecxEbeN5yZXa/hXjzJafBTJp3VTMlXUGOfA== X-Received: by 2002:a17:902:ec82:b0:14a:6b35:903 with SMTP id x2-20020a170902ec8200b0014a6b350903mr11826986plg.78.1642963248015; Sun, 23 Jan 2022 10:40:48 -0800 (PST) Received: from localhost (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id q21sm13893599pfj.94.2022.01.23.10.40.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 10:40:47 -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, Florian Fainelli , Thomas Gleixner , Marc Zyngier , bcm-kernel-feedback-list@broadcom.com, linux-mips@vger.kernel.org Subject: [PATCH 19/54] drivers/irqchip: replace cpumask_weight with cpumask_empty where appropriate Date: Sun, 23 Jan 2022 10:38:50 -0800 Message-Id: <20220123183925.1052919-20-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 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org bcm6345_l1_of_init() calls cpumask_weight() to check if any bit of a given cpumask is set. We can do it more efficiently with cpumask_empty() because cpumask_empty() stops traversing the cpumask as soon as it finds first set bit, while cpumask_weight() counts all bits unconditionally. Signed-off-by: Yury Norov Acked-by: Florian Fainelli --- drivers/irqchip/irq-bcm6345-l1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-bcm6345-l1.c b/drivers/irqchip/irq-bcm6345-l1.c index fd079215c17f..142a7431745f 100644 --- a/drivers/irqchip/irq-bcm6345-l1.c +++ b/drivers/irqchip/irq-bcm6345-l1.c @@ -315,7 +315,7 @@ static int __init bcm6345_l1_of_init(struct device_node *dn, cpumask_set_cpu(idx, &intc->cpumask); } - if (!cpumask_weight(&intc->cpumask)) { + if (cpumask_empty(&intc->cpumask)) { ret = -ENODEV; goto out_free; } From patchwork Sun Jan 23 18:39:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12721096 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 D9CD6C433F5 for ; Sun, 23 Jan 2022 18:42:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240090AbiAWSmo (ORCPT ); Sun, 23 Jan 2022 13:42:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239899AbiAWSlx (ORCPT ); Sun, 23 Jan 2022 13:41:53 -0500 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E724C0613EE; Sun, 23 Jan 2022 10:41:47 -0800 (PST) Received: by mail-pf1-x434.google.com with SMTP id u130so9498904pfc.2; Sun, 23 Jan 2022 10:41:47 -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=fUD3By+Q+kq98PS9J46Zo9V/GV4St0mmKcFfwwO9Pb8=; b=K1iIT+1E2cEHkTf9YJEGufFMzj+1Eh7+cQ1FoYkqUeKs/xVJZ8bsBzPqbE+az5UcOF 3N8dLMXOE9d+QRCy7gbLXLdF0+I4cTggikREfhOztuJnumxxAHkt4rbDqPCOopgasrHg CifKAdMoNw1LqCWQI9py1vRrOdGwG43vlNKwIAPHLqcdjgI+EHDWFVHNzP5YykPOq44x 9QKl41c3DWud2s6j5qb22F4E30o25hALFnzf108ytQymFZ1W+tpflr656JLCzb7dZlaq 79StCTlGk+PiEDZ2KwRGMk+GircEjWTnb9bYlBtUG0HBcuVDzYqTHzylz2vMtMmszbQ1 F0oA== 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=fUD3By+Q+kq98PS9J46Zo9V/GV4St0mmKcFfwwO9Pb8=; b=2W74cVVt6RL4kW+puBFgmctKrbpNfDzLAlgQTYjzDP/frJQFsiGZCmjClqFQxgKl5Y b1rzcfo87K1LBxmKuU2e1kZYeUA7sH1i0UezQJ8cjuHU8wIS+t+SEzoj5yEWNLBMI1Z3 u48jvDPDS8A/i+zkXuG+rnjDH/C+MqoTwd2czNcVJG290Al0d9QSZo8RO3X4IVkwqOx5 lT+N1lg7at8UM+uFmcC7NwwrIwmvUWR3vuH0MlfJgc0HGJdkWWd+Y1hOXOPsgXXepNYU e142jc7UL5VymSJc5m9w9au4wdRbK1NIIKfo7hqrheZO0cvRKh7IB6suJj/sKFiUgvjL Eelg== X-Gm-Message-State: AOAM533wAKPtJhBmFsCzCIApw+vpMwtaRzXpoxcBCUuFPjSxJsv2O+r9 5A9IuC2fChmNwMXrTWX3s6iMkx5LbLw= X-Google-Smtp-Source: ABdhPJzgui0t/epPuAWCm48+9aVBhNRSHTduGzhQc69xdNO0+dJyfJfNKcCZ70W6D4Q4vze3O9f0vA== X-Received: by 2002:a63:3710:: with SMTP id e16mr9494755pga.507.1642963306975; Sun, 23 Jan 2022 10:41:46 -0800 (PST) Received: from localhost (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id mm24sm11135471pjb.20.2022.01.23.10.41.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 10:41:46 -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, Thomas Bogendoerfer , Mark Rutland , Marc Zyngier , linux-mips@vger.kernel.org Subject: [PATCH 38/54] arch/mips: replace cpumask_weight with cpumask_weight_{eq, ...} where appropriate Date: Sun, 23 Jan 2022 10:39:09 -0800 Message-Id: <20220123183925.1052919-39-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 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Mips code uses 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 Acked-by: Thomas Bogendoerfer --- arch/mips/cavium-octeon/octeon-irq.c | 4 ++-- arch/mips/kernel/crash.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c index 844f882096e6..914871f15fb7 100644 --- a/arch/mips/cavium-octeon/octeon-irq.c +++ b/arch/mips/cavium-octeon/octeon-irq.c @@ -763,7 +763,7 @@ static void octeon_irq_cpu_offline_ciu(struct irq_data *data) if (!cpumask_test_cpu(cpu, mask)) return; - if (cpumask_weight(mask) > 1) { + if (cpumask_weight_gt(mask, 1)) { /* * It has multi CPU affinity, just remove this CPU * from the affinity set. @@ -795,7 +795,7 @@ static int octeon_irq_ciu_set_affinity(struct irq_data *data, * This removes the need to do locking in the .ack/.eoi * functions. */ - if (cpumask_weight(dest) != 1) + if (!cpumask_weight_eq(dest, 1)) return -EINVAL; if (!enable_one) diff --git a/arch/mips/kernel/crash.c b/arch/mips/kernel/crash.c index 81845ba04835..5b690d52491f 100644 --- a/arch/mips/kernel/crash.c +++ b/arch/mips/kernel/crash.c @@ -72,7 +72,7 @@ static void crash_kexec_prepare_cpus(void) */ pr_emerg("Sending IPI to other cpus...\n"); msecs = 10000; - while ((cpumask_weight(&cpus_in_crash) < ncpus) && (--msecs > 0)) { + while (cpumask_weight_lt(&cpus_in_crash, ncpus) && (--msecs > 0)) { cpu_relax(); mdelay(1); }