Re: [PATCH 10/54] net: ethernet: replace bitmap_weight with bitmap_empty for qlogic

From: Andy Shevchenko
Date: Mon Jan 24 2022 - 07:29:15 EST


On Sun, Jan 23, 2022 at 10:38:41AM -0800, Yury Norov wrote:
> qlogic/qed code 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.

> - if (bitmap_weight((unsigned long *)&pmap[item], 64 * 8))
> + if (!bitmap_empty((unsigned long *)&pmap[item], 64 * 8))

> - (bitmap_weight((unsigned long *)&pmap[item],
> + (!bitmap_empty((unsigned long *)&pmap[item],

Side note, these castings reminds me previous discussion and I'm wondering
if you have this kind of potentially problematic places in your TODO as
subject to fix.


--
With Best Regards,
Andy Shevchenko