Commit 77b6c42e authored by Mateusz Kulikowski's avatar Mateusz Kulikowski Committed by Greg Kroah-Hartman

staging: rtl8192e: Simplify _rtl92e_calculate_bit_shift

Use ffs instead of iteration. Behaviour of function doesn't change.
Signed-off-by: default avatarMateusz Kulikowski <mateusz.kulikowski@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fcf481db
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
* wlanfae <wlanfae@realtek.com> * wlanfae <wlanfae@realtek.com>
******************************************************************************/ ******************************************************************************/
#include <linux/bitops.h>
#include "rtl_core.h" #include "rtl_core.h"
#include "r8192E_hw.h" #include "r8192E_hw.h"
#include "r8192E_phyreg.h" #include "r8192E_phyreg.h"
...@@ -50,13 +51,9 @@ static void _rtl92e_phy_rf_fw_write(struct net_device *dev, ...@@ -50,13 +51,9 @@ static void _rtl92e_phy_rf_fw_write(struct net_device *dev,
static u32 _rtl92e_calculate_bit_shift(u32 dwBitMask) static u32 _rtl92e_calculate_bit_shift(u32 dwBitMask)
{ {
u32 i; if (!dwBitMask)
return 32;
for (i = 0; i <= 31; i++) { return ffs(dwBitMask) - 1;
if (((dwBitMask >> i) & 0x1) == 1)
break;
}
return i;
} }
u8 rtl92e_is_legal_rf_path(struct net_device *dev, u32 eRFPath) u8 rtl92e_is_legal_rf_path(struct net_device *dev, u32 eRFPath)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment