001-06-v6.9-wifi-rtl8xxxu-extend-wifi-connected-check-to-both-in.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. From 9aa776209ca31695bead52674ad943848ccc97d5 Mon Sep 17 00:00:00 2001
  2. From: Martin Kaistra <[email protected]>
  3. Date: Fri, 22 Dec 2023 11:14:27 +0100
  4. Subject: [PATCH 06/21] wifi: rtl8xxxu: extend wifi connected check to both
  5. interfaces
  6. There are multiple places in the code where the current connection
  7. status of wifi is checked. The driver will support two interfaces soon
  8. and either one of them (or both) could be connected.
  9. Convert all uses of (vif && vif->cfg.assoc) to a new helper
  10. function rtl8xxxu_is_assoc() which checks both interfaces.
  11. Signed-off-by: Martin Kaistra <[email protected]>
  12. Reviewed-by: Ping-Ke Shih <[email protected]>
  13. Signed-off-by: Kalle Valo <[email protected]>
  14. Link: https://msgid.link/[email protected]
  15. ---
  16. .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 20 +++++++++----------
  17. 1 file changed, 9 insertions(+), 11 deletions(-)
  18. --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
  19. +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
  20. @@ -6043,18 +6043,20 @@ void rtl8723bu_update_bt_link_info(struc
  21. btcoex->bt_busy = false;
  22. }
  23. +static inline bool rtl8xxxu_is_assoc(struct rtl8xxxu_priv *priv)
  24. +{
  25. + return (priv->vifs[0] && priv->vifs[0]->cfg.assoc) ||
  26. + (priv->vifs[1] && priv->vifs[1]->cfg.assoc);
  27. +}
  28. +
  29. static
  30. void rtl8723bu_handle_bt_inquiry(struct rtl8xxxu_priv *priv)
  31. {
  32. - struct ieee80211_vif *vif;
  33. struct rtl8xxxu_btcoex *btcoex;
  34. - bool wifi_connected;
  35. - vif = priv->vif;
  36. btcoex = &priv->bt_coex;
  37. - wifi_connected = (vif && vif->cfg.assoc);
  38. - if (!wifi_connected) {
  39. + if (!rtl8xxxu_is_assoc(priv)) {
  40. rtl8723bu_set_ps_tdma(priv, 0x8, 0x0, 0x0, 0x0, 0x0);
  41. rtl8723bu_set_coex_with_type(priv, 0);
  42. } else if (btcoex->has_sco || btcoex->has_hid || btcoex->has_a2dp) {
  43. @@ -6072,15 +6074,11 @@ void rtl8723bu_handle_bt_inquiry(struct
  44. static
  45. void rtl8723bu_handle_bt_info(struct rtl8xxxu_priv *priv)
  46. {
  47. - struct ieee80211_vif *vif;
  48. struct rtl8xxxu_btcoex *btcoex;
  49. - bool wifi_connected;
  50. - vif = priv->vif;
  51. btcoex = &priv->bt_coex;
  52. - wifi_connected = (vif && vif->cfg.assoc);
  53. - if (wifi_connected) {
  54. + if (rtl8xxxu_is_assoc(priv)) {
  55. u32 val32 = 0;
  56. u32 high_prio_tx = 0, high_prio_rx = 0;
  57. @@ -7103,7 +7101,7 @@ static void rtl8xxxu_track_cfo(struct rt
  58. int cfo_khz_a, cfo_khz_b, cfo_average;
  59. int crystal_cap;
  60. - if (!priv->vif || !priv->vif->cfg.assoc) {
  61. + if (!rtl8xxxu_is_assoc(priv)) {
  62. /* Reset */
  63. cfo->adjust = true;