]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/forcedeth.c
ath9k: AR9280 PCI devices must serialize IO as well
[karo-tx-linux.git] / drivers / net / forcedeth.c
index e06782a60bd54ea8e2c9f1f721a74d2e551d5050..b8251e827059643203f8a5a02fa73d1156e32a34 100644 (file)
@@ -3405,10 +3405,10 @@ static irqreturn_t nv_nic_irq(int foo, void *data)
 
 #ifdef CONFIG_FORCEDETH_NAPI
                if (events & NVREG_IRQ_RX_ALL) {
+                       spin_lock(&np->lock);
                        netif_rx_schedule(&np->napi);
 
                        /* Disable furthur receive irq's */
-                       spin_lock(&np->lock);
                        np->irqmask &= ~NVREG_IRQ_RX_ALL;
 
                        if (np->msi_flags & NV_MSI_X_ENABLED)
@@ -3522,10 +3522,10 @@ static irqreturn_t nv_nic_irq_optimized(int foo, void *data)
 
 #ifdef CONFIG_FORCEDETH_NAPI
                if (events & NVREG_IRQ_RX_ALL) {
+                       spin_lock(&np->lock);
                        netif_rx_schedule(&np->napi);
 
                        /* Disable furthur receive irq's */
-                       spin_lock(&np->lock);
                        np->irqmask &= ~NVREG_IRQ_RX_ALL;
 
                        if (np->msi_flags & NV_MSI_X_ENABLED)
@@ -6011,9 +6011,20 @@ static void nv_shutdown(struct pci_dev *pdev)
        if (netif_running(dev))
                nv_close(dev);
 
-       nv_restore_mac_addr(pdev);
+       /*
+        * Restore the MAC so a kernel started by kexec won't get confused.
+        * If we really go for poweroff, we must not restore the MAC,
+        * otherwise the MAC for WOL will be reversed at least on some boards.
+        */
+       if (system_state != SYSTEM_POWER_OFF) {
+               nv_restore_mac_addr(pdev);
+       }
 
        pci_disable_device(pdev);
+       /*
+        * Apparently it is not possible to reinitialise from D3 hot,
+        * only put the device into D3 if we really go for poweroff.
+        */
        if (system_state == SYSTEM_POWER_OFF) {
                if (pci_enable_wake(pdev, PCI_D3cold, np->wolenabled))
                        pci_enable_wake(pdev, PCI_D3hot, np->wolenabled);