sctp: use bitmap_weight
Subsystems (4)
PATCH 1/1 sctp: use bitmap_weight
Use bitmap_weight to count the total number of bits set in bitmap.
Signed-off-by Akinobu Mita <[email protected]>
Cc Vlad Yasevich <[email protected]>
Cc Sridhar Samudrala <[email protected]>
--- net/sctp/tsnmap.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
net/sctp/tsnmap.c +2 -6
@@ -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; }
Signature · 1 line
1.7.11.7
PATCH 1/1 sound: use bitmap_weight
Use bitmap_weight to count the total number of bits set in bitmap.
Signed-off-by Joe Perches <[email protected]>
--- sound/usb/endpoint.c | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-)
sound/usb/endpoint.c +1 -6
@@ -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;
Takashi Iwai
AppliedRe: [PATCH] sound: use bitmap_weight
At Fri, 16 Nov 2012 23:35:16 -0800,
Quoted 4 lines · Joe Perches
Use
bitmap_weightto count the total number of bits set in bitmap.Signed-off-by Joe Perches <[email protected]>
Thanks, applied.
Takashi
Quoted 27 lines
--- sound/usb/endpoint.c | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-)sound/usb/endpoint.c +1
-6@@ -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;
Quoted 7 lines · Akinobu Mita
Use
bitmap_weightto count the total number of bits set in bitmap.Signed-off-by Akinobu Mita <[email protected]>Cc Vlad Yasevich <[email protected]>Cc Sridhar Samudrala <[email protected]>
Acked-by Vlad Yasevich <[email protected]>
-vlad
Quoted 31 lines
--- net/sctp/tsnmap.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)net/sctp/tsnmap.c +2
-6@@ -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; }
From: Vlad Yasevich <[email protected]>
Date: Sat, 17 Nov 2012 20:45:19 -0500
Quoted 10 lines · Akinobu Mita
Quoted 7 lines
Use
bitmap_weightto count the total number of bits set in bitmap.Signed-off-by Akinobu Mita <[email protected]>Cc Vlad Yasevich <[email protected]>Cc Sridhar Samudrala <[email protected]>Acked-by Vlad Yasevich <[email protected]>
Applied, thanks.