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.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index 653fe728e4a2..07dd38efe62a 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -198,7 +198,7 @@ static bool _rtl_pci_platform_switch_device_pci_aspm(
198} 198}
199 199
200/*When we set 0x01 to enable clk request. Set 0x0 to disable clk req.*/ 200/*When we set 0x01 to enable clk request. Set 0x0 to disable clk req.*/
201static bool _rtl_pci_switch_clk_req(struct ieee80211_hw *hw, u8 value) 201static void _rtl_pci_switch_clk_req(struct ieee80211_hw *hw, u8 value)
202{ 202{
203 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 203 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
204 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 204 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
@@ -207,8 +207,6 @@ static bool _rtl_pci_switch_clk_req(struct ieee80211_hw *hw, u8 value)
207 207
208 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192SE) 208 if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192SE)
209 udelay(100); 209 udelay(100);
210
211 return true;
212} 210}
213 211
214/*Disable RTL8192SE ASPM & Disable Pci Bridge ASPM*/ 212/*Disable RTL8192SE ASPM & Disable Pci Bridge ASPM*/
@@ -1150,10 +1148,12 @@ static void _rtl_pci_free_tx_ring(struct ieee80211_hw *hw,
1150 ring->idx = (ring->idx + 1) % ring->entries; 1148 ring->idx = (ring->idx + 1) % ring->entries;
1151 } 1149 }
1152 1150
1153 pci_free_consistent(rtlpci->pdev, 1151 if (ring->desc) {
1154 sizeof(*ring->desc) * ring->entries, 1152 pci_free_consistent(rtlpci->pdev,
1155 ring->desc, ring->dma); 1153 sizeof(*ring->desc) * ring->entries,
1156 ring->desc = NULL; 1154 ring->desc, ring->dma);
1155 ring->desc = NULL;
1156 }
1157} 1157}
1158 1158
1159static void _rtl_pci_free_rx_ring(struct rtl_pci *rtlpci) 1159static void _rtl_pci_free_rx_ring(struct rtl_pci *rtlpci)
@@ -1177,12 +1177,14 @@ static void _rtl_pci_free_rx_ring(struct rtl_pci *rtlpci)
1177 kfree_skb(skb); 1177 kfree_skb(skb);
1178 } 1178 }
1179 1179
1180 pci_free_consistent(rtlpci->pdev, 1180 if (rtlpci->rx_ring[rx_queue_idx].desc) {
1181 pci_free_consistent(rtlpci->pdev,
1181 sizeof(*rtlpci->rx_ring[rx_queue_idx]. 1182 sizeof(*rtlpci->rx_ring[rx_queue_idx].
1182 desc) * rtlpci->rxringcount, 1183 desc) * rtlpci->rxringcount,
1183 rtlpci->rx_ring[rx_queue_idx].desc, 1184 rtlpci->rx_ring[rx_queue_idx].desc,
1184 rtlpci->rx_ring[rx_queue_idx].dma); 1185 rtlpci->rx_ring[rx_queue_idx].dma);
1185 rtlpci->rx_ring[rx_queue_idx].desc = NULL; 1186 rtlpci->rx_ring[rx_queue_idx].desc = NULL;
1187 }
1186 } 1188 }
1187} 1189}
1188 1190
@@ -1760,8 +1762,8 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
1760 if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { 1762 if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) {
1761 RT_ASSERT(false, 1763 RT_ASSERT(false,
1762 "Unable to obtain 32bit DMA for consistent allocations\n"); 1764 "Unable to obtain 32bit DMA for consistent allocations\n");
1763 pci_disable_device(pdev); 1765 err = -ENOMEM;
1764 return -ENOMEM; 1766 goto fail1;
1765 } 1767 }
1766 } 1768 }
1767 1769
@@ -1803,7 +1805,7 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
1803 err = pci_request_regions(pdev, KBUILD_MODNAME); 1805 err = pci_request_regions(pdev, KBUILD_MODNAME);
1804 if (err) { 1806 if (err) {
1805 RT_ASSERT(false, "Can't obtain PCI resources\n"); 1807 RT_ASSERT(false, "Can't obtain PCI resources\n");
1806 goto fail2; 1808 goto fail1;
1807 } 1809 }
1808 1810
1809 pmem_start = pci_resource_start(pdev, rtlpriv->cfg->bar_id); 1811 pmem_start = pci_resource_start(pdev, rtlpriv->cfg->bar_id);
@@ -1816,6 +1818,7 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
1816 rtlpriv->cfg->bar_id, pmem_len); 1818 rtlpriv->cfg->bar_id, pmem_len);
1817 if (rtlpriv->io.pci_mem_start == 0) { 1819 if (rtlpriv->io.pci_mem_start == 0) {
1818 RT_ASSERT(false, "Can't map PCI mem\n"); 1820 RT_ASSERT(false, "Can't map PCI mem\n");
1821 err = -ENOMEM;
1819 goto fail2; 1822 goto fail2;
1820 } 1823 }
1821 1824
@@ -1832,8 +1835,10 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
1832 pci_write_config_byte(pdev, 0x04, 0x07); 1835 pci_write_config_byte(pdev, 0x04, 0x07);
1833 1836
1834 /* find adapter */ 1837 /* find adapter */
1835 if (!_rtl_pci_find_adapter(pdev, hw)) 1838 if (!_rtl_pci_find_adapter(pdev, hw)) {
1839 err = -ENODEV;
1836 goto fail3; 1840 goto fail3;
1841 }
1837 1842
1838 /* Init IO handler */ 1843 /* Init IO handler */
1839 _rtl_pci_io_handler_init(&pdev->dev, hw); 1844 _rtl_pci_io_handler_init(&pdev->dev, hw);
@@ -1843,6 +1848,7 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
1843 1848
1844 if (rtlpriv->cfg->ops->init_sw_vars(hw)) { 1849 if (rtlpriv->cfg->ops->init_sw_vars(hw)) {
1845 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n"); 1850 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n");
1851 err = -ENODEV;
1846 goto fail3; 1852 goto fail3;
1847 } 1853 }
1848 1854
@@ -1887,7 +1893,6 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
1887 return 0; 1893 return 0;
1888 1894
1889fail3: 1895fail3:
1890 pci_set_drvdata(pdev, NULL);
1891 rtl_deinit_core(hw); 1896 rtl_deinit_core(hw);
1892 _rtl_pci_io_handler_release(hw); 1897 _rtl_pci_io_handler_release(hw);
1893 1898
@@ -1899,10 +1904,12 @@ fail2:
1899 complete(&rtlpriv->firmware_loading_complete); 1904 complete(&rtlpriv->firmware_loading_complete);
1900 1905
1901fail1: 1906fail1:
1902 1907 if (hw)
1908 ieee80211_free_hw(hw);
1909 pci_set_drvdata(pdev, NULL);
1903 pci_disable_device(pdev); 1910 pci_disable_device(pdev);
1904 1911
1905 return -ENODEV; 1912 return err;
1906 1913
1907} 1914}
1908EXPORT_SYMBOL(rtl_pci_probe); 1915EXPORT_SYMBOL(rtl_pci_probe);