diff options
| author | 2022-08-06 08:09:27 +0200 | |
|---|---|---|
| committer | 2022-08-16 15:16:16 +0200 | |
| commit | 270e05092e09b22e083b5e2802a73b52a6b813eb (patch) | |
| tree | e38e32723c81c805fb9eb5e3b58a45325ba7ed0a | |
| parent | staging: r8188eu: convert rtw_p2p_enable to correct error code semantics (diff) | |
staging: r8188eu: use ffs() in phy_CalculateBitShift()
Use ffs() in phy_CalculateBitShift() to simplify the function and
improve readability.
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220806060929.11022-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c index dea6d915a1f4..3d8fcc1f0b6a 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c @@ -25,13 +25,9 @@ */ static u32 phy_CalculateBitShift(u32 BitMask) { - u32 i; + u32 i = ffs(BitMask); - for (i = 0; i <= 31; i++) { - if (((BitMask >> i) & 0x1) == 1) - break; - } - return i; + return i ? i - 1 : 32; } /** |
