All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sctp: use bitmap_weight
@ 2012-11-17  6:39 ` Akinobu Mita
  0 siblings, 0 replies; 9+ messages in thread
From: Akinobu Mita @ 2012-11-17  6:39 UTC (permalink / raw)
  To: linux-sctp; +Cc: Akinobu Mita, Vlad Yasevich, Sridhar Samudrala, netdev

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

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Vlad Yasevich <vyasevich@gmail.com>
Cc: Sridhar Samudrala <sri@us.ibm.com>
Cc: linux-sctp@vger.kernel.org
Cc: netdev@vger.kernel.org
---
 net/sctp/tsnmap.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/net/sctp/tsnmap.c b/net/sctp/tsnmap.c
index b5fb7c4..5f25e0c 100644
--- a/net/sctp/tsnmap.c
+++ b/net/sctp/tsnmap.c
@@ -272,7 +272,7 @@ __u16 sctp_tsnmap_pending(struct sctp_tsnmap *map)
 	__u32 max_tsn = map->max_tsn_seen;
 	__u32 base_tsn = map->base_tsn;
 	__u16 pending_data;
-	u32 gap, i;
+	u32 gap;
 
 	pending_data = max_tsn - cum_tsn;
 	gap = max_tsn - base_tsn;
@@ -280,11 +280,7 @@ __u16 sctp_tsnmap_pending(struct sctp_tsnmap *map)
 	if (gap == 0 || gap >= map->len)
 		goto out;
 
-	for (i = 0; i < gap+1; i++) {
-		if (test_bit(i, map->tsn_map))
-			pending_data--;
-	}
-
+	pending_data -= bitmap_weight(map->tsn_map, gap + 1);
 out:
 	return pending_data;
 }
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH] sctp: use bitmap_weight
@ 2012-11-17  6:39 ` Akinobu Mita
  0 siblings, 0 replies; 9+ messages in thread
From: Akinobu Mita @ 2012-11-17  6:39 UTC (permalink / raw)
  To: linux-sctp; +Cc: Akinobu Mita, Vlad Yasevich, Sridhar Samudrala, netdev

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

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Vlad Yasevich <vyasevich@gmail.com>
Cc: Sridhar Samudrala <sri@us.ibm.com>
Cc: linux-sctp@vger.kernel.org
Cc: netdev@vger.kernel.org
---
 net/sctp/tsnmap.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/net/sctp/tsnmap.c b/net/sctp/tsnmap.c
index b5fb7c4..5f25e0c 100644
--- a/net/sctp/tsnmap.c
+++ b/net/sctp/tsnmap.c
@@ -272,7 +272,7 @@ __u16 sctp_tsnmap_pending(struct sctp_tsnmap *map)
 	__u32 max_tsn = map->max_tsn_seen;
 	__u32 base_tsn = map->base_tsn;
 	__u16 pending_data;
-	u32 gap, i;
+	u32 gap;
 
 	pending_data = max_tsn - cum_tsn;
 	gap = max_tsn - base_tsn;
@@ -280,11 +280,7 @@ __u16 sctp_tsnmap_pending(struct sctp_tsnmap *map)
 	if (gap = 0 || gap >= map->len)
 		goto out;
 
-	for (i = 0; i < gap+1; i++) {
-		if (test_bit(i, map->tsn_map))
-			pending_data--;
-	}
-
+	pending_data -= bitmap_weight(map->tsn_map, gap + 1);
 out:
 	return pending_data;
 }
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH] sound: use bitmap_weight
  2012-11-17  6:39 ` Akinobu Mita
@ 2012-11-17  7:35   ` Joe Perches
  -1 siblings, 0 replies; 9+ messages in thread
From: Joe Perches @ 2012-11-17  7:35 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Akinobu Mita, alsa-devel, LKML

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;
 



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH] sound: use bitmap_weight
@ 2012-11-17  7:35   ` Joe Perches
  0 siblings, 0 replies; 9+ messages in thread
From: Joe Perches @ 2012-11-17  7:35 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, Akinobu Mita, LKML

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;
 

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] sound: use bitmap_weight
  2012-11-17  7:35   ` Joe Perches
  (?)
@ 2012-11-17 10:36   ` Takashi Iwai
  -1 siblings, 0 replies; 9+ messages in thread
From: Takashi Iwai @ 2012-11-17 10:36 UTC (permalink / raw)
  To: Joe Perches; +Cc: Akinobu Mita, alsa-devel, LKML

At Fri, 16 Nov 2012 23:35:16 -0800,
Joe Perches wrote:
> 
> Use bitmap_weight to count the total number of bits set in bitmap.
> 
> Signed-off-by: Joe Perches <joe@perches.com>

Thanks, applied.


Takashi

> ---
>  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;
>  
> 
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] sctp: use bitmap_weight
  2012-11-17  6:39 ` Akinobu Mita
@ 2012-11-18  1:45   ` Vlad Yasevich
  -1 siblings, 0 replies; 9+ messages in thread
From: Vlad Yasevich @ 2012-11-18  1:45 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: linux-sctp, Sridhar Samudrala, netdev

On 11/17/2012 01:39 AM, Akinobu Mita wrote:
> Use bitmap_weight to count the total number of bits set in bitmap.
>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> Cc: Vlad Yasevich <vyasevich@gmail.com>
> Cc: Sridhar Samudrala <sri@us.ibm.com>
> Cc: linux-sctp@vger.kernel.org
> Cc: netdev@vger.kernel.org

Acked-by: Vlad Yasevich <vyasevich@gmail.com>

-vlad

> ---
>   net/sctp/tsnmap.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/net/sctp/tsnmap.c b/net/sctp/tsnmap.c
> index b5fb7c4..5f25e0c 100644
> --- a/net/sctp/tsnmap.c
> +++ b/net/sctp/tsnmap.c
> @@ -272,7 +272,7 @@ __u16 sctp_tsnmap_pending(struct sctp_tsnmap *map)
>   	__u32 max_tsn = map->max_tsn_seen;
>   	__u32 base_tsn = map->base_tsn;
>   	__u16 pending_data;
> -	u32 gap, i;
> +	u32 gap;
>
>   	pending_data = max_tsn - cum_tsn;
>   	gap = max_tsn - base_tsn;
> @@ -280,11 +280,7 @@ __u16 sctp_tsnmap_pending(struct sctp_tsnmap *map)
>   	if (gap == 0 || gap >= map->len)
>   		goto out;
>
> -	for (i = 0; i < gap+1; i++) {
> -		if (test_bit(i, map->tsn_map))
> -			pending_data--;
> -	}
> -
> +	pending_data -= bitmap_weight(map->tsn_map, gap + 1);
>   out:
>   	return pending_data;
>   }
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] sctp: use bitmap_weight
@ 2012-11-18  1:45   ` Vlad Yasevich
  0 siblings, 0 replies; 9+ messages in thread
From: Vlad Yasevich @ 2012-11-18  1:45 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: linux-sctp, Sridhar Samudrala, netdev

On 11/17/2012 01:39 AM, Akinobu Mita wrote:
> Use bitmap_weight to count the total number of bits set in bitmap.
>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> Cc: Vlad Yasevich <vyasevich@gmail.com>
> Cc: Sridhar Samudrala <sri@us.ibm.com>
> Cc: linux-sctp@vger.kernel.org
> Cc: netdev@vger.kernel.org

Acked-by: Vlad Yasevich <vyasevich@gmail.com>

-vlad

> ---
>   net/sctp/tsnmap.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/net/sctp/tsnmap.c b/net/sctp/tsnmap.c
> index b5fb7c4..5f25e0c 100644
> --- a/net/sctp/tsnmap.c
> +++ b/net/sctp/tsnmap.c
> @@ -272,7 +272,7 @@ __u16 sctp_tsnmap_pending(struct sctp_tsnmap *map)
>   	__u32 max_tsn = map->max_tsn_seen;
>   	__u32 base_tsn = map->base_tsn;
>   	__u16 pending_data;
> -	u32 gap, i;
> +	u32 gap;
>
>   	pending_data = max_tsn - cum_tsn;
>   	gap = max_tsn - base_tsn;
> @@ -280,11 +280,7 @@ __u16 sctp_tsnmap_pending(struct sctp_tsnmap *map)
>   	if (gap = 0 || gap >= map->len)
>   		goto out;
>
> -	for (i = 0; i < gap+1; i++) {
> -		if (test_bit(i, map->tsn_map))
> -			pending_data--;
> -	}
> -
> +	pending_data -= bitmap_weight(map->tsn_map, gap + 1);
>   out:
>   	return pending_data;
>   }
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] sctp: use bitmap_weight
  2012-11-18  1:45   ` Vlad Yasevich
@ 2012-11-18  3:01     ` David Miller
  -1 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2012-11-18  3:01 UTC (permalink / raw)
  To: vyasevich; +Cc: akinobu.mita, linux-sctp, sri, netdev

From: Vlad Yasevich <vyasevich@gmail.com>
Date: Sat, 17 Nov 2012 20:45:19 -0500

> On 11/17/2012 01:39 AM, Akinobu Mita wrote:
>> Use bitmap_weight to count the total number of bits set in bitmap.
>>
>> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
>> Cc: Vlad Yasevich <vyasevich@gmail.com>
>> Cc: Sridhar Samudrala <sri@us.ibm.com>
>> Cc: linux-sctp@vger.kernel.org
>> Cc: netdev@vger.kernel.org
> 
> Acked-by: Vlad Yasevich <vyasevich@gmail.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] sctp: use bitmap_weight
@ 2012-11-18  3:01     ` David Miller
  0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2012-11-18  3:01 UTC (permalink / raw)
  To: vyasevich; +Cc: akinobu.mita, linux-sctp, sri, netdev

From: Vlad Yasevich <vyasevich@gmail.com>
Date: Sat, 17 Nov 2012 20:45:19 -0500

> On 11/17/2012 01:39 AM, Akinobu Mita wrote:
>> Use bitmap_weight to count the total number of bits set in bitmap.
>>
>> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
>> Cc: Vlad Yasevich <vyasevich@gmail.com>
>> Cc: Sridhar Samudrala <sri@us.ibm.com>
>> Cc: linux-sctp@vger.kernel.org
>> Cc: netdev@vger.kernel.org
> 
> Acked-by: Vlad Yasevich <vyasevich@gmail.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-11-18  3:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-17  6:39 [PATCH] sctp: use bitmap_weight Akinobu Mita
2012-11-17  6:39 ` Akinobu Mita
2012-11-17  7:35 ` [PATCH] sound: " Joe Perches
2012-11-17  7:35   ` 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

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.