X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=package%2Fkernel%2Fmac80211%2Fpatches%2Frtl%2F001-06-v6.9-wifi-rtl8xxxu-extend-wifi-connected-check-to-both-in.patch;fp=package%2Fkernel%2Fmac80211%2Fpatches%2Frtl%2F001-06-v6.9-wifi-rtl8xxxu-extend-wifi-connected-check-to-both-in.patch;h=70879f861ffea040ddf5491a18272d023fae13f9;hb=97f542238a23a1c8461b40dfb26d9213826d8e78;hp=0000000000000000000000000000000000000000;hpb=860dd27617812bc25627d716436b88cf3f1cbe9d;p=openwrt%2Fopenwrt.git diff --git a/package/kernel/mac80211/patches/rtl/001-06-v6.9-wifi-rtl8xxxu-extend-wifi-connected-check-to-both-in.patch b/package/kernel/mac80211/patches/rtl/001-06-v6.9-wifi-rtl8xxxu-extend-wifi-connected-check-to-both-in.patch new file mode 100644 index 0000000000..70879f861f --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-06-v6.9-wifi-rtl8xxxu-extend-wifi-connected-check-to-both-in.patch @@ -0,0 +1,75 @@ +From 9aa776209ca31695bead52674ad943848ccc97d5 Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:27 +0100 +Subject: [PATCH 06/21] wifi: rtl8xxxu: extend wifi connected check to both + interfaces + +There are multiple places in the code where the current connection +status of wifi is checked. The driver will support two interfaces soon +and either one of them (or both) could be connected. + +Convert all uses of (vif && vif->cfg.assoc) to a new helper +function rtl8xxxu_is_assoc() which checks both interfaces. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-7-martin.kaistra@linutronix.de +--- + .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 20 +++++++++---------- + 1 file changed, 9 insertions(+), 11 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -6043,18 +6043,20 @@ void rtl8723bu_update_bt_link_info(struc + btcoex->bt_busy = false; + } + ++static inline bool rtl8xxxu_is_assoc(struct rtl8xxxu_priv *priv) ++{ ++ return (priv->vifs[0] && priv->vifs[0]->cfg.assoc) || ++ (priv->vifs[1] && priv->vifs[1]->cfg.assoc); ++} ++ + static + void rtl8723bu_handle_bt_inquiry(struct rtl8xxxu_priv *priv) + { +- struct ieee80211_vif *vif; + struct rtl8xxxu_btcoex *btcoex; +- bool wifi_connected; + +- vif = priv->vif; + btcoex = &priv->bt_coex; +- wifi_connected = (vif && vif->cfg.assoc); + +- if (!wifi_connected) { ++ if (!rtl8xxxu_is_assoc(priv)) { + rtl8723bu_set_ps_tdma(priv, 0x8, 0x0, 0x0, 0x0, 0x0); + rtl8723bu_set_coex_with_type(priv, 0); + } else if (btcoex->has_sco || btcoex->has_hid || btcoex->has_a2dp) { +@@ -6072,15 +6074,11 @@ void rtl8723bu_handle_bt_inquiry(struct + static + void rtl8723bu_handle_bt_info(struct rtl8xxxu_priv *priv) + { +- struct ieee80211_vif *vif; + struct rtl8xxxu_btcoex *btcoex; +- bool wifi_connected; + +- vif = priv->vif; + btcoex = &priv->bt_coex; +- wifi_connected = (vif && vif->cfg.assoc); + +- if (wifi_connected) { ++ if (rtl8xxxu_is_assoc(priv)) { + u32 val32 = 0; + u32 high_prio_tx = 0, high_prio_rx = 0; + +@@ -7103,7 +7101,7 @@ static void rtl8xxxu_track_cfo(struct rt + int cfo_khz_a, cfo_khz_b, cfo_average; + int crystal_cap; + +- if (!priv->vif || !priv->vif->cfg.assoc) { ++ if (!rtl8xxxu_is_assoc(priv)) { + /* Reset */ + cfo->adjust = true; +