aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorFrancois Romieu <romieu@fr.zoreil.com>2006-02-27 17:15:06 -0500
committerFrancois Romieu <romieu@fr.zoreil.com>2006-02-27 17:15:06 -0500
commit576cfa934e357c44d6259f90c7d065de328a3691 (patch)
tree1a82797c3c394aa3d0d4c37cebab0f55ad2afc89 /drivers
parentb3c3e7d7d9795df16012d5c60e5f789e7fade311 (diff)
8139cp: fix broken suspend/resume
- check that the device is up before it is enabled again; - the descriptor ring indexes must be set to zero before cp_init_hw() is issued. Add a nice comment to remember that skb allocation failure is still not handled. Fixes http://bugzilla.kernel.org/show_bug.cgi?id=5681 Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/8139cp.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index f822cd3025ff..dd410496aadb 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -1118,13 +1118,18 @@ err_out:
1118 return -ENOMEM; 1118 return -ENOMEM;
1119} 1119}
1120 1120
1121static void cp_init_rings_index (struct cp_private *cp)
1122{
1123 cp->rx_tail = 0;
1124 cp->tx_head = cp->tx_tail = 0;
1125}
1126
1121static int cp_init_rings (struct cp_private *cp) 1127static int cp_init_rings (struct cp_private *cp)
1122{ 1128{
1123 memset(cp->tx_ring, 0, sizeof(struct cp_desc) * CP_TX_RING_SIZE); 1129 memset(cp->tx_ring, 0, sizeof(struct cp_desc) * CP_TX_RING_SIZE);
1124 cp->tx_ring[CP_TX_RING_SIZE - 1].opts1 = cpu_to_le32(RingEnd); 1130 cp->tx_ring[CP_TX_RING_SIZE - 1].opts1 = cpu_to_le32(RingEnd);
1125 1131
1126 cp->rx_tail = 0; 1132 cp_init_rings_index(cp);
1127 cp->tx_head = cp->tx_tail = 0;
1128 1133
1129 return cp_refill_rx (cp); 1134 return cp_refill_rx (cp);
1130} 1135}
@@ -1886,30 +1891,30 @@ static int cp_suspend (struct pci_dev *pdev, pm_message_t state)
1886 1891
1887 spin_unlock_irqrestore (&cp->lock, flags); 1892 spin_unlock_irqrestore (&cp->lock, flags);
1888 1893
1889 if (cp->pdev && cp->wol_enabled) { 1894 pci_save_state(pdev);
1890 pci_save_state (cp->pdev); 1895 pci_enable_wake(pdev, pci_choose_state(pdev, state), cp->wol_enabled);
1891 cp_set_d3_state (cp); 1896 pci_set_power_state(pdev, pci_choose_state(pdev, state));
1892 }
1893 1897
1894 return 0; 1898 return 0;
1895} 1899}
1896 1900
1897static int cp_resume (struct pci_dev *pdev) 1901static int cp_resume (struct pci_dev *pdev)
1898{ 1902{
1899 struct net_device *dev; 1903 struct net_device *dev = pci_get_drvdata (pdev);
1900 struct cp_private *cp; 1904 struct cp_private *cp = netdev_priv(dev);
1901 unsigned long flags; 1905 unsigned long flags;
1902 1906
1903 dev = pci_get_drvdata (pdev); 1907 if (!netif_running(dev))
1904 cp = netdev_priv(dev); 1908 return 0;
1905 1909
1906 netif_device_attach (dev); 1910 netif_device_attach (dev);
1907 1911
1908 if (cp->pdev && cp->wol_enabled) { 1912 pci_set_power_state(pdev, PCI_D0);
1909 pci_set_power_state (cp->pdev, PCI_D0); 1913 pci_restore_state(pdev);
1910 pci_restore_state (cp->pdev); 1914 pci_enable_wake(pdev, PCI_D0, 0);
1911 } 1915
1912 1916 /* FIXME: sh*t may happen if the Rx ring buffer is depleted */
1917 cp_init_rings_index (cp);
1913 cp_init_hw (cp); 1918 cp_init_hw (cp);
1914 netif_start_queue (dev); 1919 netif_start_queue (dev);
1915 1920