Message ID | 20220210224933.379149-9-yury.norov@gmail.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | None | expand |
On Fri, 11 Feb 2022 at 02:09, Yury Norov <yury.norov@gmail.com> wrote: > > 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> > --- > 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)); Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > > reserved = smp->reserved[cid]; > > -- > 2.32.0 >
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];
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> --- drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)