Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "Yury Norov" <yury.norov@gmail.com>,
	"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"David Laight" <David.Laight@aculab.com>,
	"Joe Perches" <joe@perches.com>,
	"Dennis Zhou" <dennis@kernel.org>,
	"Emil Renner Berthing" <kernel@esmil.dk>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Matti Vaittinen" <matti.vaittinen@fi.rohmeurope.com>,
	"Alexey Klimov" <aklimov@redhat.com>,
	linux-kernel@vger.kernel.org,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Alexandru Ardelean" <alexandru.ardelean@analog.com>,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH 29/54] drivers/iio: replace bitmap_weight() with bitmap_weight_{eq,gt} where appropriate
Date: Sun, 30 Jan 2022 12:54:08 +0000	[thread overview]
Message-ID: <20220130125408.0cca0b66@jic23-huawei> (raw)
In-Reply-To: <Ye6fsynB1/q0ZLui@smile.fi.intel.com>

On Mon, 24 Jan 2022 14:46:43 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Sun, Jan 23, 2022 at 10:39:00AM -0800, Yury Norov wrote:
> > 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, gt}
> > because conditional bitmap_weight may stop traversing the bitmap earlier,
> > as soon as condition is met.  
> 
> ...
> 
> >  		int i, j;
> >  
> >  		for (i = 0, j = 0;
> > -		     i < bitmap_weight(indio_dev->active_scan_mask,
> > -				       indio_dev->masklength);
> > +		     bitmap_weight_gt(indio_dev->active_scan_mask,
> > +				       indio_dev->masklength, i);
> >  		     i++, j++) {
> >  			j = find_next_bit(indio_dev->active_scan_mask,
> >  					  indio_dev->masklength, j);  
> 
> This smells like room for improvement. Have you checked this deeply?
> 

I have no idea what I was smoking that day.
It was near 10 years ago, so I'll blame my younger self ;)

Jonathan

      reply	other threads:[~2022-01-30 12:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220123183925.1052919-1-yury.norov@gmail.com>
2022-01-23 18:39 ` [PATCH 29/54] drivers/iio: replace bitmap_weight() with bitmap_weight_{eq,gt} where appropriate Yury Norov
2022-01-24 12:46   ` Andy Shevchenko
2022-01-30 12:54     ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220130125408.0cca0b66@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=David.Laight@aculab.com \
    --cc=aklimov@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexandru.ardelean@analog.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dennis@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=kernel@esmil.dk \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=nathan@kernel.org \
    --cc=npiggin@gmail.com \
    --cc=peterz@infradead.org \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox