diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index dd0c32379375..b83d65481ce6 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c @@ -886,6 +886,8 @@ static int ath9k_hif_usb_alloc_rx_urbs(struct hif_device_usb *hif_dev) static void ath9k_hif_usb_dealloc_reg_in_urbs(struct hif_device_usb *hif_dev) { + printk("ath9k_debug %s, %d\n", __func__, __LINE__); + dump_stack(); usb_kill_anchored_urbs(&hif_dev->reg_in_submitted); } @@ -895,6 +897,9 @@ static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev) struct sk_buff *skb = NULL; int i, ret; + printk("ath9k_debug %s, %d\n", __func__, __LINE__); + dump_stack(); + init_usb_anchor(&hif_dev->reg_in_submitted); for (i = 0; i < MAX_REG_IN_URB_NUM; i++) { @@ -949,6 +954,8 @@ static int ath9k_hif_usb_alloc_reg_in_urbs(struct hif_device_usb *hif_dev) static int ath9k_hif_usb_alloc_urbs(struct hif_device_usb *hif_dev) { + printk("ath9k_debug %s, %d\n", __func__, __LINE__); + dump_stack(); /* Register Write */ init_usb_anchor(&hif_dev->regout_submitted); @@ -975,6 +982,8 @@ static int ath9k_hif_usb_alloc_urbs(struct hif_device_usb *hif_dev) static void ath9k_hif_usb_dealloc_urbs(struct hif_device_usb *hif_dev) { + printk("ath9k_debug %s, %d\n", __func__, __LINE__); + dump_stack(); usb_kill_anchored_urbs(&hif_dev->regout_submitted); ath9k_hif_usb_dealloc_reg_in_urbs(hif_dev); ath9k_hif_usb_dealloc_tx_urbs(hif_dev); @@ -1159,6 +1168,7 @@ static void ath9k_hif_usb_firmware_cb(const struct firmware *fw, void *context) struct hif_device_usb *hif_dev = context; int ret; + printk("ath9k_debug %s, %d\n", __func__, __LINE__); if (!fw) { ret = ath9k_hif_request_firmware(hif_dev, false); if (!ret) @@ -1170,6 +1180,7 @@ static void ath9k_hif_usb_firmware_cb(const struct firmware *fw, void *context) goto err_fw; } + printk("ath9k_debug %s, %d\n", __func__, __LINE__); hif_dev->htc_handle = ath9k_htc_hw_alloc(hif_dev, &hif_usb, &hif_dev->udev->dev); if (hif_dev->htc_handle == NULL) @@ -1195,6 +1206,7 @@ static void ath9k_hif_usb_firmware_cb(const struct firmware *fw, void *context) } release_firmware(fw); + printk("ath9k_debug %s, %d\n", __func__, __LINE__); hif_dev->flags |= HIF_USB_READY; complete_all(&hif_dev->fw_done); @@ -1203,6 +1215,7 @@ static void ath9k_hif_usb_firmware_cb(const struct firmware *fw, void *context) err_htc_hw_init: ath9k_hif_usb_dev_deinit(hif_dev); err_dev_init: + printk("ath9k_debug %s, %d\n", __func__, __LINE__); ath9k_htc_hw_free(hif_dev->htc_handle); err_dev_alloc: release_firmware(fw); @@ -1300,6 +1313,8 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface, if (ret) goto err_fw_req; + printk("ath9k_debug %s, %d\n", __func__, __LINE__); + return ret; err_fw_req: @@ -1339,10 +1354,14 @@ static void ath9k_hif_usb_disconnect(struct usb_interface *interface) wait_for_completion(&hif_dev->fw_done); + printk("ath9k_debug %s, %d\n", __func__, __LINE__); if (hif_dev->flags & HIF_USB_READY) { + printk("ath9k_debug %s, %d\n", __func__, __LINE__); ath9k_htc_hw_deinit(hif_dev->htc_handle, unplugged); - ath9k_htc_hw_free(hif_dev->htc_handle); ath9k_hif_usb_dev_deinit(hif_dev); + smp_mb(); + ath9k_destoy_wmi(hif_dev->htc_handle->drv_priv); + ath9k_htc_hw_free(hif_dev->htc_handle); } usb_set_intfdata(interface, NULL); diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index d961095ab01f..d1d0ed6e653c 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c @@ -982,7 +982,7 @@ void ath9k_htc_disconnect_device(struct htc_target *htc_handle, bool hotunplug) htc_handle->drv_priv->ah->ah_flags |= AH_UNPLUGGED; ath9k_deinit_device(htc_handle->drv_priv); - ath9k_deinit_wmi(htc_handle->drv_priv); + ath9k_stop_wmi(htc_handle->drv_priv); ieee80211_free_hw(htc_handle->drv_priv->hw); } } diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c index d091c8ebdcf0..e0b663bf164e 100644 --- a/drivers/net/wireless/ath/ath9k/htc_hst.c +++ b/drivers/net/wireless/ath/ath9k/htc_hst.c @@ -279,7 +279,6 @@ int htc_connect_service(struct htc_target *target, if (!time_left) { dev_err(target->dev, "Service connection timeout for: %d\n", service_connreq->service_id); - kfree_skb(skb); return -ETIMEDOUT; } @@ -491,6 +490,8 @@ struct htc_target *ath9k_htc_hw_alloc(void *hif_handle, void ath9k_htc_hw_free(struct htc_target *htc) { + printk("ath9k_debug %s, %d\n", __func__, __LINE__); + dump_stack(); kfree(htc); } diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c index cdc146091194..94f95676e02c 100644 --- a/drivers/net/wireless/ath/ath9k/wmi.c +++ b/drivers/net/wireless/ath/ath9k/wmi.c @@ -123,6 +123,20 @@ void ath9k_deinit_wmi(struct ath9k_htc_priv *priv) kfree(priv->wmi); } +void ath9k_stop_wmi(struct ath9k_htc_priv *priv) +{ + struct wmi *wmi = priv->wmi; + + mutex_lock(&wmi->op_mutex); + wmi->stopped = true; + mutex_unlock(&wmi->op_mutex); +} + +void ath9k_destoy_wmi(struct ath9k_htc_priv *priv) +{ + kfree(priv->wmi); +} + void ath9k_wmi_event_drain(struct ath9k_htc_priv *priv) { unsigned long flags; diff --git a/drivers/net/wireless/ath/ath9k/wmi.h b/drivers/net/wireless/ath/ath9k/wmi.h index 380175d5ecd7..c3e278377365 100644 --- a/drivers/net/wireless/ath/ath9k/wmi.h +++ b/drivers/net/wireless/ath/ath9k/wmi.h @@ -189,6 +189,8 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id, void ath9k_wmi_event_tasklet(unsigned long data); void ath9k_fatal_work(struct work_struct *work); void ath9k_wmi_event_drain(struct ath9k_htc_priv *priv); +void ath9k_stop_wmi(struct ath9k_htc_priv *priv); +void ath9k_destoy_wmi(struct ath9k_htc_priv *priv); #define WMI_CMD(_wmi_cmd) \ do { \