aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtlwifi/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rtlwifi/pci.c')
-rw-r--r--drivers/net/wireless/rtlwifi/pci.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index e4d1dcfe8299..5cb2199435d2 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -1565,6 +1565,9 @@ static void rtl_pci_stop(struct ieee80211_hw *hw)
1565 1565
1566 rtlpci->driver_is_goingto_unload = true; 1566 rtlpci->driver_is_goingto_unload = true;
1567 rtlpriv->cfg->ops->hw_disable(hw); 1567 rtlpriv->cfg->ops->hw_disable(hw);
1568 /* some things are not needed if firmware not available */
1569 if (!rtlpriv->max_fw_size)
1570 return;
1568 rtlpriv->cfg->ops->led_control(hw, LED_CTL_POWER_OFF); 1571 rtlpriv->cfg->ops->led_control(hw, LED_CTL_POWER_OFF);
1569 1572
1570 spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flags); 1573 spin_lock_irqsave(&rtlpriv->locks.rf_ps_lock, flags);
@@ -1779,6 +1782,7 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
1779 rtlpriv = hw->priv; 1782 rtlpriv = hw->priv;
1780 pcipriv = (void *)rtlpriv->priv; 1783 pcipriv = (void *)rtlpriv->priv;
1781 pcipriv->dev.pdev = pdev; 1784 pcipriv->dev.pdev = pdev;
1785 init_completion(&rtlpriv->firmware_loading_complete);
1782 1786
1783 /* init cfg & intf_ops */ 1787 /* init cfg & intf_ops */
1784 rtlpriv->rtlhal.interface = INTF_PCI; 1788 rtlpriv->rtlhal.interface = INTF_PCI;
@@ -1799,7 +1803,7 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
1799 err = pci_request_regions(pdev, KBUILD_MODNAME); 1803 err = pci_request_regions(pdev, KBUILD_MODNAME);
1800 if (err) { 1804 if (err) {
1801 RT_ASSERT(false, "Can't obtain PCI resources\n"); 1805 RT_ASSERT(false, "Can't obtain PCI resources\n");
1802 return err; 1806 goto fail2;
1803 } 1807 }
1804 1808
1805 pmem_start = pci_resource_start(pdev, rtlpriv->cfg->bar_id); 1809 pmem_start = pci_resource_start(pdev, rtlpriv->cfg->bar_id);
@@ -1862,15 +1866,6 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
1862 goto fail3; 1866 goto fail3;
1863 } 1867 }
1864 1868
1865 err = ieee80211_register_hw(hw);
1866 if (err) {
1867 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1868 "Can't register mac80211 hw\n");
1869 goto fail3;
1870 } else {
1871 rtlpriv->mac80211.mac80211_registered = 1;
1872 }
1873
1874 err = sysfs_create_group(&pdev->dev.kobj, &rtl_attribute_group); 1869 err = sysfs_create_group(&pdev->dev.kobj, &rtl_attribute_group);
1875 if (err) { 1870 if (err) {
1876 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, 1871 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
@@ -1878,9 +1873,6 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
1878 goto fail3; 1873 goto fail3;
1879 } 1874 }
1880 1875
1881 /*init rfkill */
1882 rtl_init_rfkill(hw);
1883
1884 rtlpci = rtl_pcidev(pcipriv); 1876 rtlpci = rtl_pcidev(pcipriv);
1885 err = request_irq(rtlpci->pdev->irq, &_rtl_pci_interrupt, 1877 err = request_irq(rtlpci->pdev->irq, &_rtl_pci_interrupt,
1886 IRQF_SHARED, KBUILD_MODNAME, hw); 1878 IRQF_SHARED, KBUILD_MODNAME, hw);
@@ -1889,24 +1881,22 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
1889 "%s: failed to register IRQ handler\n", 1881 "%s: failed to register IRQ handler\n",
1890 wiphy_name(hw->wiphy)); 1882 wiphy_name(hw->wiphy));
1891 goto fail3; 1883 goto fail3;
1892 } else {
1893 rtlpci->irq_alloc = 1;
1894 } 1884 }
1885 rtlpci->irq_alloc = 1;
1895 1886
1896 set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status);
1897 return 0; 1887 return 0;
1898 1888
1899fail3: 1889fail3:
1900 pci_set_drvdata(pdev, NULL); 1890 pci_set_drvdata(pdev, NULL);
1901 rtl_deinit_core(hw); 1891 rtl_deinit_core(hw);
1902 _rtl_pci_io_handler_release(hw); 1892 _rtl_pci_io_handler_release(hw);
1903 ieee80211_free_hw(hw);
1904 1893
1905 if (rtlpriv->io.pci_mem_start != 0) 1894 if (rtlpriv->io.pci_mem_start != 0)
1906 pci_iounmap(pdev, (void __iomem *)rtlpriv->io.pci_mem_start); 1895 pci_iounmap(pdev, (void __iomem *)rtlpriv->io.pci_mem_start);
1907 1896
1908fail2: 1897fail2:
1909 pci_release_regions(pdev); 1898 pci_release_regions(pdev);
1899 complete(&rtlpriv->firmware_loading_complete);
1910 1900
1911fail1: 1901fail1:
1912 1902
@@ -1925,6 +1915,8 @@ void rtl_pci_disconnect(struct pci_dev *pdev)
1925 struct rtl_pci *rtlpci = rtl_pcidev(pcipriv); 1915 struct rtl_pci *rtlpci = rtl_pcidev(pcipriv);
1926 struct rtl_mac *rtlmac = rtl_mac(rtlpriv); 1916 struct rtl_mac *rtlmac = rtl_mac(rtlpriv);
1927 1917
1918 /* just in case driver is removed before firmware callback */
1919 wait_for_completion(&rtlpriv->firmware_loading_complete);
1928 clear_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status); 1920 clear_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status);
1929 1921
1930 sysfs_remove_group(&pdev->dev.kobj, &rtl_attribute_group); 1922 sysfs_remove_group(&pdev->dev.kobj, &rtl_attribute_group);