diff options
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/ath/ar9170/usb.c | 11 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ar9170/usb.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 2 |
4 files changed, 20 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ar9170/usb.c b/drivers/net/wireless/ath/ar9170/usb.c index 0259bb46247d..c7405b642fef 100644 --- a/drivers/net/wireless/ath/ar9170/usb.c +++ b/drivers/net/wireless/ath/ar9170/usb.c | |||
@@ -736,12 +736,16 @@ static void ar9170_usb_firmware_failed(struct ar9170_usb *aru) | |||
736 | { | 736 | { |
737 | struct device *parent = aru->udev->dev.parent; | 737 | struct device *parent = aru->udev->dev.parent; |
738 | 738 | ||
739 | complete(&aru->firmware_loading_complete); | ||
740 | |||
739 | /* unbind anything failed */ | 741 | /* unbind anything failed */ |
740 | if (parent) | 742 | if (parent) |
741 | down(&parent->sem); | 743 | down(&parent->sem); |
742 | device_release_driver(&aru->udev->dev); | 744 | device_release_driver(&aru->udev->dev); |
743 | if (parent) | 745 | if (parent) |
744 | up(&parent->sem); | 746 | up(&parent->sem); |
747 | |||
748 | usb_put_dev(aru->udev); | ||
745 | } | 749 | } |
746 | 750 | ||
747 | static void ar9170_usb_firmware_finish(const struct firmware *fw, void *context) | 751 | static void ar9170_usb_firmware_finish(const struct firmware *fw, void *context) |
@@ -770,6 +774,8 @@ static void ar9170_usb_firmware_finish(const struct firmware *fw, void *context) | |||
770 | if (err) | 774 | if (err) |
771 | goto err_unrx; | 775 | goto err_unrx; |
772 | 776 | ||
777 | complete(&aru->firmware_loading_complete); | ||
778 | usb_put_dev(aru->udev); | ||
773 | return; | 779 | return; |
774 | 780 | ||
775 | err_unrx: | 781 | err_unrx: |
@@ -867,6 +873,7 @@ static int ar9170_usb_probe(struct usb_interface *intf, | |||
867 | init_usb_anchor(&aru->tx_pending); | 873 | init_usb_anchor(&aru->tx_pending); |
868 | init_usb_anchor(&aru->tx_submitted); | 874 | init_usb_anchor(&aru->tx_submitted); |
869 | init_completion(&aru->cmd_wait); | 875 | init_completion(&aru->cmd_wait); |
876 | init_completion(&aru->firmware_loading_complete); | ||
870 | spin_lock_init(&aru->tx_urb_lock); | 877 | spin_lock_init(&aru->tx_urb_lock); |
871 | 878 | ||
872 | aru->tx_pending_urbs = 0; | 879 | aru->tx_pending_urbs = 0; |
@@ -886,6 +893,7 @@ static int ar9170_usb_probe(struct usb_interface *intf, | |||
886 | if (err) | 893 | if (err) |
887 | goto err_freehw; | 894 | goto err_freehw; |
888 | 895 | ||
896 | usb_get_dev(aru->udev); | ||
889 | return request_firmware_nowait(THIS_MODULE, 1, "ar9170.fw", | 897 | return request_firmware_nowait(THIS_MODULE, 1, "ar9170.fw", |
890 | &aru->udev->dev, GFP_KERNEL, aru, | 898 | &aru->udev->dev, GFP_KERNEL, aru, |
891 | ar9170_usb_firmware_step2); | 899 | ar9170_usb_firmware_step2); |
@@ -905,6 +913,9 @@ static void ar9170_usb_disconnect(struct usb_interface *intf) | |||
905 | return; | 913 | return; |
906 | 914 | ||
907 | aru->common.state = AR9170_IDLE; | 915 | aru->common.state = AR9170_IDLE; |
916 | |||
917 | wait_for_completion(&aru->firmware_loading_complete); | ||
918 | |||
908 | ar9170_unregister(&aru->common); | 919 | ar9170_unregister(&aru->common); |
909 | ar9170_usb_cancel_urbs(aru); | 920 | ar9170_usb_cancel_urbs(aru); |
910 | 921 | ||
diff --git a/drivers/net/wireless/ath/ar9170/usb.h b/drivers/net/wireless/ath/ar9170/usb.h index a2ce3b169ceb..919b06046eb3 100644 --- a/drivers/net/wireless/ath/ar9170/usb.h +++ b/drivers/net/wireless/ath/ar9170/usb.h | |||
@@ -71,6 +71,7 @@ struct ar9170_usb { | |||
71 | unsigned int tx_pending_urbs; | 71 | unsigned int tx_pending_urbs; |
72 | 72 | ||
73 | struct completion cmd_wait; | 73 | struct completion cmd_wait; |
74 | struct completion firmware_loading_complete; | ||
74 | int readlen; | 75 | int readlen; |
75 | u8 *readbuf; | 76 | u8 *readbuf; |
76 | 77 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index d18c61223ac5..dc283769780e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -1776,6 +1776,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1776 | 1776 | ||
1777 | /* We have our copies now, allow OS release its copies */ | 1777 | /* We have our copies now, allow OS release its copies */ |
1778 | release_firmware(ucode_raw); | 1778 | release_firmware(ucode_raw); |
1779 | complete(&priv->_agn.firmware_loading_complete); | ||
1779 | return; | 1780 | return; |
1780 | 1781 | ||
1781 | try_again: | 1782 | try_again: |
@@ -1789,6 +1790,7 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
1789 | IWL_ERR(priv, "failed to allocate pci memory\n"); | 1790 | IWL_ERR(priv, "failed to allocate pci memory\n"); |
1790 | iwl_dealloc_ucode_pci(priv); | 1791 | iwl_dealloc_ucode_pci(priv); |
1791 | out_unbind: | 1792 | out_unbind: |
1793 | complete(&priv->_agn.firmware_loading_complete); | ||
1792 | device_release_driver(&priv->pci_dev->dev); | 1794 | device_release_driver(&priv->pci_dev->dev); |
1793 | release_firmware(ucode_raw); | 1795 | release_firmware(ucode_raw); |
1794 | } | 1796 | } |
@@ -3586,6 +3588,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3586 | iwl_power_initialize(priv); | 3588 | iwl_power_initialize(priv); |
3587 | iwl_tt_initialize(priv); | 3589 | iwl_tt_initialize(priv); |
3588 | 3590 | ||
3591 | init_completion(&priv->_agn.firmware_loading_complete); | ||
3592 | |||
3589 | err = iwl_request_firmware(priv, true); | 3593 | err = iwl_request_firmware(priv, true); |
3590 | if (err) | 3594 | if (err) |
3591 | goto out_remove_sysfs; | 3595 | goto out_remove_sysfs; |
@@ -3626,6 +3630,8 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev) | |||
3626 | if (!priv) | 3630 | if (!priv) |
3627 | return; | 3631 | return; |
3628 | 3632 | ||
3633 | wait_for_completion(&priv->_agn.firmware_loading_complete); | ||
3634 | |||
3629 | IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); | 3635 | IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n"); |
3630 | 3636 | ||
3631 | iwl_dbgfs_unregister(priv); | 3637 | iwl_dbgfs_unregister(priv); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 58c69a5798d4..cd3b932ae808 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -1242,6 +1242,8 @@ struct iwl_priv { | |||
1242 | 1242 | ||
1243 | struct iwl_rx_phy_res last_phy_res; | 1243 | struct iwl_rx_phy_res last_phy_res; |
1244 | bool last_phy_res_valid; | 1244 | bool last_phy_res_valid; |
1245 | |||
1246 | struct completion firmware_loading_complete; | ||
1245 | } _agn; | 1247 | } _agn; |
1246 | #endif | 1248 | #endif |
1247 | }; | 1249 | }; |