MIPS: Sibyte: Use hweight8 instead of counting bits
authorAkinobu Mita <akinobu.mita@gmail.com>
Fri, 13 Nov 2009 07:04:53 +0000 (16:04 +0900)
committerRalf Baechle <ralf@linux-mips.org>
Thu, 17 Dec 2009 01:57:16 +0000 (01:57 +0000)
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/637/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/mm/cerr-sb1.c

index 1bd1f18ac23c5d0fe0120555051b98bb5cb7169c..3571090ba17816e332a2843d6aee478131154932 100644 (file)
@@ -567,13 +567,10 @@ static uint32_t extract_dc(unsigned short addr, int data)
                                datalo = ((unsigned long long)datalohi << 32) | datalolo;
                                ecc = dc_ecc(datalo);
                                if (ecc != datahi) {
-                                       int bits = 0;
+                                       int bits;
                                        bad_ecc |= 1 << (3-offset);
                                        ecc ^= datahi;
-                                       while (ecc) {
-                                               if (ecc & 1) bits++;
-                                               ecc >>= 1;
-                                       }
+                                       bits = hweight8(ecc);
                                        res |= (bits == 1) ? CP0_CERRD_DATA_SBE : CP0_CERRD_DATA_DBE;
                                }
                                printk("  %02X-%016llX", datahi, datalo);