Message ID | 20220210224933.379149-29-yury.norov@gmail.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | [01/49] net: dsa: don't use bitmap_weight() in b53_arl_read() | expand |
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c index f504ed351b3e..98c54022fecf 100644 --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c @@ -331,7 +331,7 @@ int iio_trigger_detach_poll_func(struct iio_trigger *trig, { struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(pf->indio_dev); bool no_other_users = - bitmap_weight(trig->pool, CONFIG_IIO_CONSUMERS_PER_TRIGGER) == 1; + bitmap_weight_eq(trig->pool, CONFIG_IIO_CONSUMERS_PER_TRIGGER, 1); int ret = 0; if (trig->ops && trig->ops->set_trigger_state && no_other_users) {
drivers/iio calls bitmap_weight() to compare the weight of bitmap with a given number. We can do it more efficiently with bitmap_weight_eq because conditional bitmap_weight may stop traversing the bitmap earlier, as soon as condition is (or can't be) met. Signed-off-by: Yury Norov <yury.norov@gmail.com> --- drivers/iio/industrialio-trigger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)