Commit 8447ac26 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Rename bitmap_clear to bitmap_zero, remove CLEAR_BITMAP

From: Rusty Russell <rusty@rustcorp.com.au>

clear_bit(n, addr) clears the nth bit.
test_and_clear_bit(n, addr) clears the nth bit.
cpu_clear(n, cpumask) clears the nth bit (vs. cpus_clear()).
bitmap_clear(bitmap, n) clears out all the bits up to n.

Moreover, there's a CLEAR_BITMAP() in linux/types.h which bitmap_clear() is
a wrapper for.

Rename bitmap_clear to bitmap_zero, which is harder to confuse (yes, it bit
me), and make everyone use it.
parent 6ab26f0a
...@@ -91,7 +91,7 @@ sn2_global_tlb_purge (unsigned long start, unsigned long end, unsigned long nbit ...@@ -91,7 +91,7 @@ sn2_global_tlb_purge (unsigned long start, unsigned long end, unsigned long nbit
short nasids[NR_NODES], nix; short nasids[NR_NODES], nix;
DECLARE_BITMAP(nodes_flushed, NR_NODES); DECLARE_BITMAP(nodes_flushed, NR_NODES);
CLEAR_BITMAP(nodes_flushed, NR_NODES); bitmap_zero(nodes_flushed, NR_NODES);
i = 0; i = 0;
......
...@@ -1743,7 +1743,7 @@ static void run_service(struct lanai_dev *lanai) ...@@ -1743,7 +1743,7 @@ static void run_service(struct lanai_dev *lanai)
read_lock(&vcc_sklist_lock); read_lock(&vcc_sklist_lock);
vci_bitfield_iterate(lanai, lanai->transmit_ready, vci_bitfield_iterate(lanai, lanai->transmit_ready,
iter_transmit); iter_transmit);
CLEAR_BITMAP(&lanai->transmit_ready, NUM_VCI); bitmap_zero(lanai->transmit_ready, NUM_VCI);
read_unlock(&vcc_sklist_lock); read_unlock(&vcc_sklist_lock);
} }
} }
...@@ -2158,8 +2158,8 @@ static int __init lanai_dev_open(struct atm_dev *atmdev) ...@@ -2158,8 +2158,8 @@ static int __init lanai_dev_open(struct atm_dev *atmdev)
/* Basic device fields */ /* Basic device fields */
lanai->number = atmdev->number; lanai->number = atmdev->number;
lanai->num_vci = NUM_VCI; lanai->num_vci = NUM_VCI;
CLEAR_BITMAP(&lanai->backlog_vccs, NUM_VCI); bitmap_zero(lanai->backlog_vccs, NUM_VCI);
CLEAR_BITMAP(&lanai->transmit_ready, NUM_VCI); bitmap_zero(lanai->transmit_ready, NUM_VCI);
lanai->naal0 = 0; lanai->naal0 = 0;
#ifdef USE_POWERDOWN #ifdef USE_POWERDOWN
lanai->nbound = 0; lanai->nbound = 0;
......
...@@ -24,7 +24,7 @@ struct hpsb_tlabel_pool { ...@@ -24,7 +24,7 @@ struct hpsb_tlabel_pool {
#define HPSB_TPOOL_INIT(_tp) \ #define HPSB_TPOOL_INIT(_tp) \
do { \ do { \
CLEAR_BITMAP((_tp)->pool, 64); \ bitmap_zero((_tp)->pool, 64); \
spin_lock_init(&(_tp)->lock); \ spin_lock_init(&(_tp)->lock); \
(_tp)->next = 0; \ (_tp)->next = 0; \
(_tp)->allocations = 0; \ (_tp)->allocations = 0; \
......
...@@ -329,7 +329,7 @@ static void __init init_tags( void ) ...@@ -329,7 +329,7 @@ static void __init init_tags( void )
for( target = 0; target < 8; ++target ) { for( target = 0; target < 8; ++target ) {
for( lun = 0; lun < 8; ++lun ) { for( lun = 0; lun < 8; ++lun ) {
ta = &TagAlloc[target][lun]; ta = &TagAlloc[target][lun];
CLEAR_BITMAP( ta->allocated, MAX_TAGS ); bitmap_zero(ta->allocated, MAX_TAGS);
ta->nr_allocated = 0; ta->nr_allocated = 0;
/* At the beginning, assume the maximum queue size we could /* At the beginning, assume the maximum queue size we could
* support (MAX_TAGS). This value will be decreased if the target * support (MAX_TAGS). This value will be decreased if the target
...@@ -438,7 +438,7 @@ static void free_all_tags( void ) ...@@ -438,7 +438,7 @@ static void free_all_tags( void )
for( target = 0; target < 8; ++target ) { for( target = 0; target < 8; ++target ) {
for( lun = 0; lun < 8; ++lun ) { for( lun = 0; lun < 8; ++lun ) {
ta = &TagAlloc[target][lun]; ta = &TagAlloc[target][lun];
CLEAR_BITMAP( ta->allocated, MAX_TAGS ); bitmap_zero(ta->allocated, MAX_TAGS);
ta->nr_allocated = 0; ta->nr_allocated = 0;
} }
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#define cpus_and(dst,src1,src2) bitmap_and((dst).mask,(src1).mask, (src2).mask, NR_CPUS) #define cpus_and(dst,src1,src2) bitmap_and((dst).mask,(src1).mask, (src2).mask, NR_CPUS)
#define cpus_or(dst,src1,src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, NR_CPUS) #define cpus_or(dst,src1,src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, NR_CPUS)
#define cpus_clear(map) bitmap_clear((map).mask, NR_CPUS) #define cpus_clear(map) bitmap_zero((map).mask, NR_CPUS)
#define cpus_complement(map) bitmap_complement((map).mask, NR_CPUS) #define cpus_complement(map) bitmap_complement((map).mask, NR_CPUS)
#define cpus_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, NR_CPUS) #define cpus_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, NR_CPUS)
#define cpus_empty(map) bitmap_empty(map.mask, NR_CPUS) #define cpus_empty(map) bitmap_empty(map.mask, NR_CPUS)
......
...@@ -52,7 +52,7 @@ typedef struct physid_mask physid_mask_t; ...@@ -52,7 +52,7 @@ typedef struct physid_mask physid_mask_t;
#define physids_and(dst, src1, src2) bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS) #define physids_and(dst, src1, src2) bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
#define physids_or(dst, src1, src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS) #define physids_or(dst, src1, src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
#define physids_clear(map) bitmap_clear((map).mask, MAX_APICS) #define physids_clear(map) bitmap_zero((map).mask, MAX_APICS)
#define physids_complement(map) bitmap_complement((map).mask, MAX_APICS) #define physids_complement(map) bitmap_complement((map).mask, MAX_APICS)
#define physids_empty(map) bitmap_empty((map).mask, MAX_APICS) #define physids_empty(map) bitmap_empty((map).mask, MAX_APICS)
#define physids_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, MAX_APICS) #define physids_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, MAX_APICS)
......
...@@ -211,7 +211,7 @@ typedef struct physid_mask physid_mask_t; ...@@ -211,7 +211,7 @@ typedef struct physid_mask physid_mask_t;
#define physids_and(dst, src1, src2) bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS) #define physids_and(dst, src1, src2) bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
#define physids_or(dst, src1, src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS) #define physids_or(dst, src1, src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
#define physids_clear(map) bitmap_clear((map).mask, MAX_APICS) #define physids_clear(map) bitmap_zero((map).mask, MAX_APICS)
#define physids_complement(map) bitmap_complement((map).mask, MAX_APICS) #define physids_complement(map) bitmap_complement((map).mask, MAX_APICS)
#define physids_empty(map) bitmap_empty((map).mask, MAX_APICS) #define physids_empty(map) bitmap_empty((map).mask, MAX_APICS)
#define physids_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, MAX_APICS) #define physids_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, MAX_APICS)
......
...@@ -16,9 +16,9 @@ int bitmap_equal(const unsigned long *bitmap1, ...@@ -16,9 +16,9 @@ int bitmap_equal(const unsigned long *bitmap1,
unsigned long *bitmap2, int bits); unsigned long *bitmap2, int bits);
void bitmap_complement(unsigned long *bitmap, int bits); void bitmap_complement(unsigned long *bitmap, int bits);
static inline void bitmap_clear(unsigned long *bitmap, int bits) static inline void bitmap_zero(unsigned long *bitmap, int bits)
{ {
CLEAR_BITMAP((unsigned long *)bitmap, bits); memset(bitmap, 0, BITS_TO_LONGS(bits)*sizeof(unsigned long));
} }
static inline void bitmap_fill(unsigned long *bitmap, int bits) static inline void bitmap_fill(unsigned long *bitmap, int bits)
......
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
(((bits)+BITS_PER_LONG-1)/BITS_PER_LONG) (((bits)+BITS_PER_LONG-1)/BITS_PER_LONG)
#define DECLARE_BITMAP(name,bits) \ #define DECLARE_BITMAP(name,bits) \
unsigned long name[BITS_TO_LONGS(bits)] unsigned long name[BITS_TO_LONGS(bits)]
#define CLEAR_BITMAP(name,bits) \
memset(name, 0, BITS_TO_LONGS(bits)*sizeof(unsigned long))
#endif #endif
#include <linux/posix_types.h> #include <linux/posix_types.h>
......
...@@ -273,7 +273,7 @@ int bitmap_parse(const char __user *ubuf, unsigned int ubuflen, ...@@ -273,7 +273,7 @@ int bitmap_parse(const char __user *ubuf, unsigned int ubuflen,
int c, old_c, totaldigits, ndigits, nchunks, nbits; int c, old_c, totaldigits, ndigits, nchunks, nbits;
u32 chunk; u32 chunk;
bitmap_clear(maskp, nmaskbits); bitmap_zero(maskp, nmaskbits);
nchunks = nbits = totaldigits = c = 0; nchunks = nbits = totaldigits = c = 0;
do { do {
......
...@@ -1222,7 +1222,7 @@ static void __init build_zonelists(pg_data_t *pgdat) ...@@ -1222,7 +1222,7 @@ static void __init build_zonelists(pg_data_t *pgdat)
local_node = pgdat->node_id; local_node = pgdat->node_id;
load = numnodes; load = numnodes;
prev_node = local_node; prev_node = local_node;
CLEAR_BITMAP(used_mask, MAX_NUMNODES); bitmap_zero(used_mask, MAX_NUMNODES);
while ((node = find_next_best_node(local_node, used_mask)) >= 0) { while ((node = find_next_best_node(local_node, used_mask)) >= 0) {
/* /*
* We don't want to pressure a particular node. * We don't want to pressure a particular node.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment