Commit 80850ca0 authored by Bitterblue Smith's avatar Bitterblue Smith Committed by Kalle Valo

wifi: rtl8xxxu: Fix off by one initial RTS rate

rtl8xxxu_set_basic_rates() sets the wrong initial RTS rate. It sets the
next higher rate than the one it should set, e.g. 36M instead of 24M.

The while loop was supposed to find the index of the most significant
bit which is 1, but it was copied incorrectly from the vendor driver.
Use __fls() instead.
Signed-off-by: default avatarBitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://msgid.link/761e6836-6cd6-4930-91b6-0446834655c5@gmail.com
parent 9475cc7a
...@@ -4870,10 +4870,9 @@ static void rtl8xxxu_set_basic_rates(struct rtl8xxxu_priv *priv, u32 rate_cfg) ...@@ -4870,10 +4870,9 @@ static void rtl8xxxu_set_basic_rates(struct rtl8xxxu_priv *priv, u32 rate_cfg)
dev_dbg(&priv->udev->dev, "%s: rates %08x\n", __func__, rate_cfg); dev_dbg(&priv->udev->dev, "%s: rates %08x\n", __func__, rate_cfg);
while (rate_cfg) { if (rate_cfg)
rate_cfg = (rate_cfg >> 1); rate_idx = __fls(rate_cfg);
rate_idx++;
}
rtl8xxxu_write8(priv, REG_INIRTS_RATE_SEL, rate_idx); rtl8xxxu_write8(priv, REG_INIRTS_RATE_SEL, rate_idx);
} }
......
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