1*58d6ea30SMatthew Wilcox /* lib/bitmap.c pulls in at least two other files. */ 2*58d6ea30SMatthew Wilcox 3*58d6ea30SMatthew Wilcox #include <linux/bitmap.h> 4*58d6ea30SMatthew Wilcox bitmap_clear(unsigned long * map,unsigned int start,int len)5*58d6ea30SMatthew Wilcoxvoid bitmap_clear(unsigned long *map, unsigned int start, int len) 6*58d6ea30SMatthew Wilcox { 7*58d6ea30SMatthew Wilcox unsigned long *p = map + BIT_WORD(start); 8*58d6ea30SMatthew Wilcox const unsigned int size = start + len; 9*58d6ea30SMatthew Wilcox int bits_to_clear = BITS_PER_LONG - (start % BITS_PER_LONG); 10*58d6ea30SMatthew Wilcox unsigned long mask_to_clear = BITMAP_FIRST_WORD_MASK(start); 11*58d6ea30SMatthew Wilcox 12*58d6ea30SMatthew Wilcox while (len - bits_to_clear >= 0) { 13*58d6ea30SMatthew Wilcox *p &= ~mask_to_clear; 14*58d6ea30SMatthew Wilcox len -= bits_to_clear; 15*58d6ea30SMatthew Wilcox bits_to_clear = BITS_PER_LONG; 16*58d6ea30SMatthew Wilcox mask_to_clear = ~0UL; 17*58d6ea30SMatthew Wilcox p++; 18*58d6ea30SMatthew Wilcox } 19*58d6ea30SMatthew Wilcox if (len) { 20*58d6ea30SMatthew Wilcox mask_to_clear &= BITMAP_LAST_WORD_MASK(size); 21*58d6ea30SMatthew Wilcox *p &= ~mask_to_clear; 22*58d6ea30SMatthew Wilcox } 23*58d6ea30SMatthew Wilcox } 24