summaryrefslogtreecommitdiff
path: root/drivers/staging/rtl8192e
diff options
context:
space:
mode:
authorMateusz Kulikowski <mateusz.kulikowski@gmail.com>2015-09-20 21:04:32 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-09-29 04:26:07 +0200
commit77b6c42e0278decff0c98999fb835f36048415ab (patch)
tree5f5b1cb2880423ec1f2f52ea6329b426540ebc94 /drivers/staging/rtl8192e
parentfcf481dbbd80e1206804a0fae3fd5c1debebe11c (diff)
staging: rtl8192e: Simplify _rtl92e_calculate_bit_shift
Use ffs instead of iteration. Behaviour of function doesn't change. Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8192e')
-rw-r--r--drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
index b3a10f9f01cd..0b407feb5407 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
@@ -13,6 +13,7 @@
* wlanfae <wlanfae@realtek.com>
******************************************************************************/
+#include <linux/bitops.h>
#include "rtl_core.h"
#include "r8192E_hw.h"
#include "r8192E_phyreg.h"
@@ -50,13 +51,9 @@ static void _rtl92e_phy_rf_fw_write(struct net_device *dev,
static u32 _rtl92e_calculate_bit_shift(u32 dwBitMask)
{
- u32 i;
-
- for (i = 0; i <= 31; i++) {
- if (((dwBitMask >> i) & 0x1) == 1)
- break;
- }
- return i;
+ if (!dwBitMask)
+ return 32;
+ return ffs(dwBitMask) - 1;
}
u8 rtl92e_is_legal_rf_path(struct net_device *dev, u32 eRFPath)