summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2020-09-19 09:37:47 +0300
committerKalle Valo <kvalo@codeaurora.org>2020-09-22 10:16:41 +0300
commit6c1d61913570d4255548ac598cfbef6f1e3c3eee (patch)
treed274e54d1c03bd35dec07c8c4cc276f643e6c69c /drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.c
parent7f1e215b39cb0aec39a7084b98848585efe7ba5e (diff)
downloadlinux-6c1d61913570d4255548ac598cfbef6f1e3c3eee.tar.xz
rtlwifi: Use ffs in <foo>_phy_calculate_bit_shift
Remove the loop and use the generic ffs instead. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/e2ab424d24b74901bc0c39f0c60f75e871adf2ba.camel@perches.com
Diffstat (limited to 'drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.c')
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.c
index 097f21f6d35b..47b6c1aa36b0 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723com/phy_common.c
@@ -53,13 +53,9 @@ EXPORT_SYMBOL_GPL(rtl8723_phy_set_bb_reg);
u32 rtl8723_phy_calculate_bit_shift(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;
}
EXPORT_SYMBOL_GPL(rtl8723_phy_calculate_bit_shift);