All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: Akinobu Mita <akinobu.mita@gmail.com>,
	alsa-devel@alsa-project.org, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] sound: use bitmap_weight
Date: Fri, 16 Nov 2012 23:35:16 -0800	[thread overview]
Message-ID: <1353137716.12430.3.camel@joe-AO722> (raw)
In-Reply-To: <1353134389-25583-1-git-send-email-akinobu.mita@gmail.com>

Use bitmap_weight to count the total number of bits set in bitmap.

Signed-off-by: Joe Perches <joe@perches.com>
---
 sound/usb/endpoint.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 34de6f2..51a9aa3 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -485,15 +485,10 @@ __exit_unlock:
 static int wait_clear_urbs(struct snd_usb_endpoint *ep)
 {
 	unsigned long end_time = jiffies + msecs_to_jiffies(1000);
-	unsigned int i;
 	int alive;
 
 	do {
-		alive = 0;
-		for (i = 0; i < ep->nurbs; i++)
-			if (test_bit(i, &ep->active_mask))
-				alive++;
-
+		alive = bitmap_weight(&ep->active_mask, ep->nurbs);
 		if (!alive)
 			break;
 



WARNING: multiple messages have this Message-ID (diff)
From: Joe Perches <joe@perches.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org,
	Akinobu Mita <akinobu.mita@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] sound: use bitmap_weight
Date: Fri, 16 Nov 2012 23:35:16 -0800	[thread overview]
Message-ID: <1353137716.12430.3.camel@joe-AO722> (raw)
In-Reply-To: <1353134389-25583-1-git-send-email-akinobu.mita@gmail.com>

Use bitmap_weight to count the total number of bits set in bitmap.

Signed-off-by: Joe Perches <joe@perches.com>
---
 sound/usb/endpoint.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 34de6f2..51a9aa3 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -485,15 +485,10 @@ __exit_unlock:
 static int wait_clear_urbs(struct snd_usb_endpoint *ep)
 {
 	unsigned long end_time = jiffies + msecs_to_jiffies(1000);
-	unsigned int i;
 	int alive;
 
 	do {
-		alive = 0;
-		for (i = 0; i < ep->nurbs; i++)
-			if (test_bit(i, &ep->active_mask))
-				alive++;
-
+		alive = bitmap_weight(&ep->active_mask, ep->nurbs);
 		if (!alive)
 			break;
 

  reply	other threads:[~2012-11-17  7:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-17  6:39 [PATCH] sctp: use bitmap_weight Akinobu Mita
2012-11-17  6:39 ` Akinobu Mita
2012-11-17  7:35 ` Joe Perches [this message]
2012-11-17  7:35   ` [PATCH] sound: " Joe Perches
2012-11-17 10:36   ` Takashi Iwai
2012-11-18  1:45 ` [PATCH] sctp: " Vlad Yasevich
2012-11-18  1:45   ` Vlad Yasevich
2012-11-18  3:01   ` David Miller
2012-11-18  3:01     ` David Miller

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=1353137716.12430.3.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=akinobu.mita@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tiwai@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.