]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm: replace bitmap_weight with bitmap_empty where appropriate
authorYury Norov <yury.norov@gmail.com>
Thu, 10 Feb 2022 22:48:52 +0000 (14:48 -0800)
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Fri, 18 Feb 2022 15:33:02 +0000 (18:33 +0300)
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 <yury.norov@gmail.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20220210224933.379149-9-yury.norov@gmail.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c

index d7fa2c49e7410d6f3c988aaa0e24a54bd05be802..56a3063545ec467a8313844da8bb41e2f3435461 100644 (file)
@@ -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];