devices/r8169-2.6.36-ethercat.c
changeset 2589 2b9c78543663
parent 2400 7c9c12c61104
--- a/devices/r8169-2.6.36-ethercat.c	Thu Sep 06 14:21:02 2012 +0200
+++ b/devices/r8169-2.6.36-ethercat.c	Mon Nov 03 15:20:05 2014 +0100
@@ -2733,7 +2733,7 @@
 
 	if (!tp->ecdev)
 		spin_lock_irq(&tp->lock);
-	
+
 	if (tp->phy_reset_pending(ioaddr)) {
 		/*
 		 * A busy loop could burn quite a few cycles on nowadays CPU.
@@ -3239,15 +3239,18 @@
 		RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) | RxVlan);
 
 	device_set_wakeup_enable(&pdev->dev, tp->features & RTL_FEATURE_WOL);
-	if (tp->ecdev && ecdev_open(tp->ecdev)) {
-		ecdev_withdraw(tp->ecdev);
-		goto err_out_msi_4;
-	}
-
-	if(!tp->ecdev) {
-		if (pci_dev_run_wake(pdev))
-			pm_runtime_put_noidle(&pdev->dev);
-	}
+
+	if (pci_dev_run_wake(pdev))
+		pm_runtime_put_noidle(&pdev->dev);
+
+	if (tp->ecdev) {
+		rc = ecdev_open(tp->ecdev);
+		if (rc) {
+			ecdev_withdraw(tp->ecdev);
+			goto err_out_msi_4;
+		}
+	}
+
 out:
 	return rc;
 
@@ -3354,7 +3357,6 @@
 			goto err_release_ring_2;
 
 		napi_enable(&tp->napi);
- 
 	}
 
 	rtl_hw_start(dev);
@@ -4809,7 +4811,6 @@
 		netif_stop_queue(dev);
 
 		napi_disable(&tp->napi);
- 
 	}
 
 core_down:
@@ -4970,7 +4971,7 @@
 	struct pci_dev *pdev = to_pci_dev(device);
 	struct net_device *dev = pci_get_drvdata(pdev);
 	struct rtl8169_private *tp = netdev_priv(dev);
-	
+
 	if (tp->ecdev)
  		return -EBUSY;