From patchwork Thu Feb 10 22:48:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 542204 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 97F2FC433EF for ; Thu, 10 Feb 2022 23:09:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345392AbiBJXJc (ORCPT ); Thu, 10 Feb 2022 18:09:32 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:58990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238904AbiBJXJc (ORCPT ); Thu, 10 Feb 2022 18:09:32 -0500 Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7646FC66; Thu, 10 Feb 2022 15:09:32 -0800 (PST) Received: by mail-qt1-x831.google.com with SMTP id o3so7144365qtm.12; Thu, 10 Feb 2022 15:09:32 -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=Il/njuSffEOrDW4E6Z5WwCggqy6XxgY6UGpPrL0AIR4=; b=JHJhNoUxh9ZuIiGYQov/FCIzAnjDxw6DqtVPkL1Zy1CLrsVwmf/L1YO0+GvOXbDRZ1 pqP9mY9GzQYWTgjathqD6S833i3Jn5LhtxZir6zDdzPkcq0f+VaqtHxlBS6ulo5m01Uc 5DJQwrfoKFPrAReQX/OlzhfusR6gY3jUDmZ2vXh/MK0XJxvb+JBDrj+24HC4sMqKBH2x kal6x+3q2ykI4/TCu98o6Mozggc8N7XorGZWzB7iKSz5i9wIizC8TdU+Cz+wzu1nNQay JFJ9W+P6+SkdtD9v9e2pIYBVGBN0oQwzdYpdb3O/UPoDayEfqa2+ziM7S0gFtv3xwP3k JINw== 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=Il/njuSffEOrDW4E6Z5WwCggqy6XxgY6UGpPrL0AIR4=; b=wij2CJmAo1Sp0oor3zOLtoYdXM4d3E+sJqga2rLIYQpwhx534e0hFSct8wQQrRaQhS NhPZkLGQEuHtXVV4ChYHwuJdD/euv+VwP9yyuFiIWk96GYs4wNdyPgLN0ynE2MpeDLoS HxH9UXgVAtiOks0S3JpR1+xKjmyO1giJT+WByxuxqZKsBRykOM1fDkuNPhCqpmGKecJv kwn/Tv3Qx7HGk5O8T70c7VaHeEF4q3rBVR23YkKUDazxCA5XxBRTZxIaYZ+Xu+8b8/nb 0NdTEcCpH7JGBGcHjbDk4usEK1lqOpaKKSwAuSkv2P2r3Lw+AbQqTPQtnZdhmgvYjh7q Xb8w== X-Gm-Message-State: AOAM531n4VugdfmWm5lXpAOD1/sDzuv0QK0YGPZbuWtZKmH17QvNqVyA C/IU3zPms1zPU9BBKi40vkc= X-Google-Smtp-Source: ABdhPJyv7MT5wCGfdlfCLRk0wYTBM2q1x++ztUAm4XQN4J6MUGrqRSzzk5Brej8rnmEAO7fi58Ap6g== X-Received: by 2002:a05:622a:1304:: with SMTP id v4mr6649618qtk.359.1644534571568; Thu, 10 Feb 2022 15:09:31 -0800 (PST) Received: from localhost ([12.28.44.171]) by smtp.gmail.com with ESMTPSA id s6sm11824113qtw.18.2022.02.10.15.09.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 15:09:31 -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, Rob Clark , Sean Paul , Abhinav Kumar , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 08/49] drm: replace bitmap_weight with bitmap_empty where appropriate Date: Thu, 10 Feb 2022 14:48:52 -0800 Message-Id: <20220210224933.379149-9-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 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org smp_request_block() in drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c calls bitmap_weight() to check if any bit of a given bitmap is set. It's better to use bitmap_empty() in that case because bitmap_empty() stops traversing the bitmap as soon as it finds first set bit, while bitmap_weight() counts all bits unconditionally. Signed-off-by: Yury Norov --- drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c index d7fa2c49e741..56a3063545ec 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c @@ -68,7 +68,7 @@ static int smp_request_block(struct mdp5_smp *smp, uint8_t reserved; /* we shouldn't be requesting blocks for an in-use client: */ - WARN_ON(bitmap_weight(cs, cnt) > 0); + WARN_ON(!bitmap_empty(cs, cnt)); reserved = smp->reserved[cid]; From patchwork Thu Feb 10 22:49:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 542203 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 85189C433F5 for ; Thu, 10 Feb 2022 23:29:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345665AbiBJX32 (ORCPT ); Thu, 10 Feb 2022 18:29:28 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231627AbiBJX31 (ORCPT ); Thu, 10 Feb 2022 18:29:27 -0500 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E31A7116D; Thu, 10 Feb 2022 15:29:27 -0800 (PST) Received: by mail-il1-x12e.google.com with SMTP id h11so5640655ilq.9; Thu, 10 Feb 2022 15:29:27 -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=3bNm5/uTnBAzIRKqMnmZ8YYfpkxkteIvyaUY7P/5B+o=; b=fLgRM4uji0XMP07LvJA5cjBtqm7zXPbJEBYtQDz8uGRsGjNkvOmu1mZZGhE7PFB0h8 7PGHiZ+HnW21lWBjG1Hp5A/io3C7i6JtUrMDThpe5y92omUL2lBUuwmbVl7bS3bU0t7o bZq4lw7FX7tlNYB2G04YnPLZMYUK5kOrXpdscRdaz4TtPLlDq3oaDeUrODGU15pKMaSD ocKLNnWjsh+fu2AZ1ivgdj8WAlWXHXIdIRLnA9L7DsQS1etO2PvLwSwJhPDSSGAXJiZV jG0tuxn4fxzCTULGAwmomyB/ly9laDnDKG1pIYbAduDcAzKjTa3UKRbikmrRgcduFqam Yaeg== 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=3bNm5/uTnBAzIRKqMnmZ8YYfpkxkteIvyaUY7P/5B+o=; b=0Bm/AANPXhtOTo4MvPfcduVvG7vNSHkhabvMkghPwmHeuiDTPX5YNFnPb/g9EHGqh2 fjBVFl9N10jUrCgB5t38PHPm3jlztY+pehrrx1MMCAcJ2Yue6teBJn1lFTAwGdgfiipI PDaKcrRSlf4USIghBewlGAdUFX+c/bYcg4MfEB2XZ4vd64vxoALvA30DN/Bm/ky8F7PK 216++5dECfxYb5FHmaa6ahJp40y5NKaUWK2UO8Sd0NYhOusX6TWdp58TcJ4m3CjRmzPK xhITWlYkeAg6YlFNH/1z2pgJtp6icyRW4r92IidNqwkFXgBraDUT8TXAVOEA+vfz1D0x FZHg== X-Gm-Message-State: AOAM531VaDJnNz8oCOhMo8TUYCPkobIuWSAu+FAt/9Y+DhrxN1ADEHfs cN9sFvWFTluSzEGt95CRZiQ= X-Google-Smtp-Source: ABdhPJxG4wLZX5EPMqNJ2GZN9s/YWLmAmUwDDdSVvbnGhVn58IPPvR5sZVSRf3Lr6OSWj7N5cae0BA== X-Received: by 2002:a92:d64e:: with SMTP id x14mr5598201ilp.97.1644535767261; Thu, 10 Feb 2022 15:29:27 -0800 (PST) Received: from localhost ([12.28.44.171]) by smtp.gmail.com with ESMTPSA id b5sm6717209ilr.0.2022.02.10.15.29.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 15:29:26 -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, Andy Gross , Bjorn Andersson , "Rafael J. Wysocki" , Viresh Kumar , Sudeep Holla , Cristian Marussi , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 17/49] cpufreq: replace cpumask_weight with cpumask_empty where appropriate Date: Thu, 10 Feb 2022 14:49:01 -0800 Message-Id: <20220210224933.379149-18-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 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org drivers/cpufreq 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 Reviewed-by: Sudeep Holla (for SCMI cpufreq driver) --- drivers/cpufreq/qcom-cpufreq-hw.c | 2 +- drivers/cpufreq/scmi-cpufreq.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c index 05f3d7876e44..95a0c57ab5bb 100644 --- a/drivers/cpufreq/qcom-cpufreq-hw.c +++ b/drivers/cpufreq/qcom-cpufreq-hw.c @@ -482,7 +482,7 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy) } qcom_get_related_cpus(index, policy->cpus); - if (!cpumask_weight(policy->cpus)) { + if (cpumask_empty(policy->cpus)) { dev_err(dev, "Domain-%d failed to get related CPUs\n", index); ret = -ENOENT; goto error; diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index 1e0cd4d165f0..919fa6e3f462 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -154,7 +154,7 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy) * table and opp-shared. */ ret = dev_pm_opp_of_get_sharing_cpus(cpu_dev, priv->opp_shared_cpus); - if (ret || !cpumask_weight(priv->opp_shared_cpus)) { + if (ret || cpumask_empty(priv->opp_shared_cpus)) { /* * Either opp-table is not set or no opp-shared was found. * Use the CPU mask from SCMI to designate CPUs sharing an OPP