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.


---

 25-akpm/arch/ia64/sn/kernel/sn2/sn2_smp.c   |    2 +-
 25-akpm/drivers/atm/lanai.c                 |    6 +++---
 25-akpm/drivers/ieee1394/ieee1394_types.h   |    2 +-
 25-akpm/drivers/scsi/atari_NCR5380.c        |    4 ++--
 25-akpm/include/asm-generic/cpumask_array.h |    2 +-
 25-akpm/include/asm-i386/mpspec.h           |    2 +-
 25-akpm/include/asm-x86_64/mpspec.h         |    2 +-
 25-akpm/include/linux/bitmap.h              |    4 ++--
 25-akpm/include/linux/types.h               |    2 --
 25-akpm/lib/bitmap.c                        |    2 +-
 25-akpm/mm/page_alloc.c                     |    2 +-
 11 files changed, 14 insertions(+), 16 deletions(-)

diff -puN arch/ia64/sn/kernel/sn2/sn2_smp.c~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP arch/ia64/sn/kernel/sn2/sn2_smp.c
--- 25/arch/ia64/sn/kernel/sn2/sn2_smp.c~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP	Thu Apr  8 16:42:09 2004
+++ 25-akpm/arch/ia64/sn/kernel/sn2/sn2_smp.c	Thu Apr  8 16:42:09 2004
@@ -91,7 +91,7 @@ sn2_global_tlb_purge (unsigned long star
 	short			nasids[NR_NODES], nix;
 	DECLARE_BITMAP(nodes_flushed, NR_NODES);
 
-	CLEAR_BITMAP(nodes_flushed, NR_NODES);
+	bitmap_zero(nodes_flushed, NR_NODES);
 
 	i = 0;
 
diff -puN drivers/atm/lanai.c~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP drivers/atm/lanai.c
--- 25/drivers/atm/lanai.c~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP	Thu Apr  8 16:42:09 2004
+++ 25-akpm/drivers/atm/lanai.c	Thu Apr  8 16:42:09 2004
@@ -1743,7 +1743,7 @@ static void run_service(struct lanai_dev
 		read_lock(&vcc_sklist_lock);
 		vci_bitfield_iterate(lanai, lanai->transmit_ready,
 		    iter_transmit);
-		CLEAR_BITMAP(&lanai->transmit_ready, NUM_VCI);
+		bitmap_zero(&lanai->transmit_ready, NUM_VCI);
 		read_unlock(&vcc_sklist_lock);
 	}
 }
@@ -2158,8 +2158,8 @@ static int __init lanai_dev_open(struct 
 	/* Basic device fields */
 	lanai->number = atmdev->number;
 	lanai->num_vci = NUM_VCI;
-	CLEAR_BITMAP(&lanai->backlog_vccs, NUM_VCI);
-	CLEAR_BITMAP(&lanai->transmit_ready, NUM_VCI);
+	bitmap_zero(&lanai->backlog_vccs, NUM_VCI);
+	bitmap_zero(&lanai->transmit_ready, NUM_VCI);
 	lanai->naal0 = 0;
 #ifdef USE_POWERDOWN
 	lanai->nbound = 0;
diff -puN drivers/ieee1394/ieee1394_types.h~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP drivers/ieee1394/ieee1394_types.h
--- 25/drivers/ieee1394/ieee1394_types.h~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP	Thu Apr  8 16:42:09 2004
+++ 25-akpm/drivers/ieee1394/ieee1394_types.h	Thu Apr  8 16:42:09 2004
@@ -24,7 +24,7 @@ struct hpsb_tlabel_pool {
 
 #define HPSB_TPOOL_INIT(_tp)			\
 do {						\
-	CLEAR_BITMAP((_tp)->pool, 64);		\
+	bitmap_zero((_tp)->pool, 64);		\
 	spin_lock_init(&(_tp)->lock);		\
 	(_tp)->next = 0;			\
 	(_tp)->allocations = 0;			\
diff -puN drivers/scsi/atari_NCR5380.c~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP drivers/scsi/atari_NCR5380.c
--- 25/drivers/scsi/atari_NCR5380.c~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP	Thu Apr  8 16:42:09 2004
+++ 25-akpm/drivers/scsi/atari_NCR5380.c	Thu Apr  8 16:42:09 2004
@@ -329,7 +329,7 @@ static void __init init_tags( void )
     for( target = 0; target < 8; ++target ) {
 	for( lun = 0; lun < 8; ++lun ) {
 	    ta = &TagAlloc[target][lun];
-	    CLEAR_BITMAP( ta->allocated, MAX_TAGS );
+	    bitmap_zero(ta->allocated, MAX_TAGS);
 	    ta->nr_allocated = 0;
 	    /* At the beginning, assume the maximum queue size we could
 	     * support (MAX_TAGS). This value will be decreased if the target
@@ -438,7 +438,7 @@ static void free_all_tags( void )
     for( target = 0; target < 8; ++target ) {
 	for( lun = 0; lun < 8; ++lun ) {
 	    ta = &TagAlloc[target][lun];
-	    CLEAR_BITMAP( ta->allocated, MAX_TAGS );
+	    bitmap_zero(ta->allocated, MAX_TAGS);
 	    ta->nr_allocated = 0;
 	}
     }
diff -puN include/asm-generic/cpumask_array.h~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP include/asm-generic/cpumask_array.h
--- 25/include/asm-generic/cpumask_array.h~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP	Thu Apr  8 16:42:09 2004
+++ 25-akpm/include/asm-generic/cpumask_array.h	Thu Apr  8 16:42:09 2004
@@ -16,7 +16,7 @@
 
 #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_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_equal(map1, map2)	bitmap_equal((map1).mask, (map2).mask, NR_CPUS)
 #define cpus_empty(map)		bitmap_empty(map.mask, NR_CPUS)
diff -puN include/asm-i386/mpspec.h~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP include/asm-i386/mpspec.h
--- 25/include/asm-i386/mpspec.h~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP	Thu Apr  8 16:42:09 2004
+++ 25-akpm/include/asm-i386/mpspec.h	Thu Apr  8 16:42:09 2004
@@ -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_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_empty(map)			bitmap_empty((map).mask, MAX_APICS)
 #define physids_equal(map1, map2)		bitmap_equal((map1).mask, (map2).mask, MAX_APICS)
diff -puN include/asm-x86_64/mpspec.h~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP include/asm-x86_64/mpspec.h
--- 25/include/asm-x86_64/mpspec.h~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP	Thu Apr  8 16:42:09 2004
+++ 25-akpm/include/asm-x86_64/mpspec.h	Thu Apr  8 16:42:09 2004
@@ -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_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_empty(map)			bitmap_empty((map).mask, MAX_APICS)
 #define physids_equal(map1, map2)		bitmap_equal((map1).mask, (map2).mask, MAX_APICS)
diff -puN include/linux/bitmap.h~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP include/linux/bitmap.h
--- 25/include/linux/bitmap.h~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP	Thu Apr  8 16:42:09 2004
+++ 25-akpm/include/linux/bitmap.h	Thu Apr  8 16:42:09 2004
@@ -16,9 +16,9 @@ int bitmap_equal(const unsigned long *bi
 			unsigned long *bitmap2, 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)
diff -puN include/linux/types.h~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP include/linux/types.h
--- 25/include/linux/types.h~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP	Thu Apr  8 16:42:09 2004
+++ 25-akpm/include/linux/types.h	Thu Apr  8 16:42:09 2004
@@ -8,8 +8,6 @@
 	(((bits)+BITS_PER_LONG-1)/BITS_PER_LONG)
 #define DECLARE_BITMAP(name,bits) \
 	unsigned long name[BITS_TO_LONGS(bits)]
-#define CLEAR_BITMAP(name,bits) \
-	memset(name, 0, BITS_TO_LONGS(bits)*sizeof(unsigned long))
 #endif
 
 #include <linux/posix_types.h>
diff -puN lib/bitmap.c~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP lib/bitmap.c
--- 25/lib/bitmap.c~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP	Thu Apr  8 16:42:09 2004
+++ 25-akpm/lib/bitmap.c	Thu Apr  8 16:42:09 2004
@@ -273,7 +273,7 @@ int bitmap_parse(const char __user *ubuf
 	int c, old_c, totaldigits, ndigits, nchunks, nbits;
 	u32 chunk;
 
-	bitmap_clear(maskp, nmaskbits);
+	bitmap_zero(maskp, nmaskbits);
 
 	nchunks = nbits = totaldigits = c = 0;
 	do {
diff -puN mm/page_alloc.c~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP mm/page_alloc.c
--- 25/mm/page_alloc.c~Rename-bitmap_clear-to-bitmap_zero-remove-CLEAR_BITMAP	Thu Apr  8 16:42:09 2004
+++ 25-akpm/mm/page_alloc.c	Thu Apr  8 16:42:09 2004
@@ -1256,7 +1256,7 @@ static void __init build_zonelists(pg_da
 	local_node = pgdat->node_id;
 	load = numnodes;
 	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) {
 		/*
 		 * We don't want to pressure a particular node.

_