forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/drivers/net/wireless/ath/ath9k/wmi.c
....@@ -106,8 +106,7 @@
106106 mutex_init(&wmi->multi_rmw_mutex);
107107 init_completion(&wmi->cmd_wait);
108108 INIT_LIST_HEAD(&wmi->pending_tx_events);
109
- tasklet_init(&wmi->wmi_event_tasklet, ath9k_wmi_event_tasklet,
110
- (unsigned long)wmi);
109
+ tasklet_setup(&wmi->wmi_event_tasklet, ath9k_wmi_event_tasklet);
111110
112111 return wmi;
113112 }
....@@ -121,7 +120,7 @@
121120 mutex_unlock(&wmi->op_mutex);
122121 }
123122
124
-void ath9k_destoy_wmi(struct ath9k_htc_priv *priv)
123
+void ath9k_destroy_wmi(struct ath9k_htc_priv *priv)
125124 {
126125 kfree(priv->wmi);
127126 }
....@@ -136,9 +135,9 @@
136135 spin_unlock_irqrestore(&priv->wmi->wmi_lock, flags);
137136 }
138137
139
-void ath9k_wmi_event_tasklet(unsigned long data)
138
+void ath9k_wmi_event_tasklet(struct tasklet_struct *t)
140139 {
141
- struct wmi *wmi = (struct wmi *)data;
140
+ struct wmi *wmi = from_tasklet(wmi, t, wmi_event_tasklet);
142141 struct ath9k_htc_priv *priv = wmi->drv_priv;
143142 struct wmi_cmd_hdr *hdr;
144143 void *wmi_event;
....@@ -170,6 +169,10 @@
170169 &wmi->drv_priv->fatal_work);
171170 break;
172171 case WMI_TXSTATUS_EVENTID:
172
+ /* Check if ath9k_tx_init() completed. */
173
+ if (!data_race(priv->tx.initialized))
174
+ break;
175
+
173176 spin_lock_bh(&priv->tx.tx_lock);
174177 if (priv->tx.flags & ATH9K_HTC_OP_TX_DRAIN) {
175178 spin_unlock_bh(&priv->tx.tx_lock);
....@@ -339,7 +342,6 @@
339342 ath_dbg(common, WMI, "Timeout waiting for WMI command: %s\n",
340343 wmi_cmd_to_name(cmd_id));
341344 mutex_unlock(&wmi->op_mutex);
342
- kfree_skb(skb);
343345 return -ETIMEDOUT;
344346 }
345347