b43: use standard fls for finding the most significant bit
authorRafał Miłecki <zajec5@gmail.com>
Fri, 15 Jan 2010 11:01:49 +0000 (12:01 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 15 Jan 2010 22:05:27 +0000 (17:05 -0500)
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/b43/phy_lp.c

index eb4fb4581edb0f8c5b945013c33c0b43c7bb2228..b58d6cf26580a90c79d0b84c11b9148192d241be 100644 (file)
@@ -1710,19 +1710,6 @@ static const struct lpphy_rx_iq_comp lpphy_rev2plus_iq_comp = {
        .c0 = 0,
 };
 
-static u8 lpphy_nbits(s32 val)
-{
-       u32 tmp = abs(val);
-       u8 nbits = 0;
-
-       while (tmp != 0) {
-               nbits++;
-               tmp >>= 1;
-       }
-
-       return nbits;
-}
-
 static int lpphy_calc_rx_iq_comp(struct b43_wldev *dev, u16 samples)
 {
        struct lpphy_iq_est iq_est;
@@ -1749,8 +1736,8 @@ static int lpphy_calc_rx_iq_comp(struct b43_wldev *dev, u16 samples)
                goto out;
        }
 
-       prod_msb = lpphy_nbits(prod);
-       q_msb = lpphy_nbits(qpwr);
+       prod_msb = fls(abs(prod));
+       q_msb = fls(abs(qpwr));
        tmp1 = prod_msb - 20;
 
        if (tmp1 >= 0) {