Merge branch 'mainlining'
authorCharles Manning <cdhmanning@gmail.com>
Fri, 10 Dec 2010 02:58:57 +0000 (15:58 +1300)
committerCharles Manning <cdhmanning@gmail.com>
Fri, 10 Dec 2010 02:58:57 +0000 (15:58 +1300)
1  2 
yaffs_bitmap.c

diff --combined yaffs_bitmap.c
index 6be9d26fae1ec58b3f0bd637f7e83ab878656560,b2542660b22a5ee12c86a662cedbe45c7abec3af..7df42cd0066ed84aa29836948516dd130ac23b7b
   * Chunk bitmap manipulations
   */
  
 -static Y_INLINE u8 *yaffs_block_bits(struct yaffs_dev *dev, int blk)
 +static inline u8 *yaffs_block_bits(struct yaffs_dev *dev, int blk)
  {
        if (blk < dev->internal_start_block || blk > dev->internal_end_block) {
 -              T(YAFFS_TRACE_ERROR,
 -                (TSTR("**>> yaffs: BlockBits block %d is not valid" TENDSTR),
 -                 blk));
 +              yaffs_trace(YAFFS_TRACE_ERROR,
 +                      "BlockBits block %d is not valid",
 +                      blk);
                YBUG();
        }
        return dev->chunk_bits +
@@@ -33,9 -33,9 +33,9 @@@ void yaffs_verify_chunk_bit_id(struct y
  {
        if (blk < dev->internal_start_block || blk > dev->internal_end_block ||
            chunk < 0 || chunk >= dev->param.chunks_per_block) {
 -              T(YAFFS_TRACE_ERROR,
 -                (TSTR("**>> yaffs: Chunk Id (%d:%d) invalid" TENDSTR),
 -                 blk, chunk));
 +              yaffs_trace(YAFFS_TRACE_ERROR,
 +                      "Chunk Id (%d:%d) invalid",
 +                      blk, chunk);
                YBUG();
        }
  }
@@@ -90,15 -90,9 +90,9 @@@ int yaffs_count_chunk_bits(struct yaffs
        u8 *blk_bits = yaffs_block_bits(dev, blk);
        int i;
        int n = 0;
-       for (i = 0; i < dev->chunk_bit_stride; i++) {
-               u8 x = *blk_bits;
-               while (x) {
-                       if (x & 1)
-                               n++;
-                       x >>= 1;
-               }
  
-               blk_bits++;
-       }
+       for (i = 0; i < dev->chunk_bit_stride; i++, blk_bits++)
+               n += hweight8(*blk_bits);
        return n;
  }