CHROMIUM: r8169: Enable suspend when device is idle from boot.
authorTodd Broch <tbroch@chromium.org>
Wed, 28 Dec 2011 21:02:47 +0000 (13:02 -0800)
committerOlof Johansson <olof@lixom.net>
Fri, 1 Jun 2012 06:55:52 +0000 (23:55 -0700)
The r8169 driver supports power management and correctly transistions
from active to suspend when link transistions from connected to
disconnected.  If its not connected at boot however the device remains
active after the initial probe.

This change adds a check of the link status to the idle pm_op that
will schedule a suspend if inactive.

BUG=chrome-os-partner:7360
TEST=manual
1. boot connected to LAN.  Interface works and continues to work after
disconnect & connect.

2. boot without connected to LAN.  Device's status,
/sys/bus/pci/devices/<devnum>/power/runtime_status is 'suspended'.
Connecting LAN brings up interface and transitions to 'active'.  Test
multiple connect/discoonect still functions

Change-Id: Ia9a5cc300faebbac63f77e3b7eb7cb08491f671e
Signed-off-by: Todd Broch <tbroch@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/13516

drivers/net/ethernet/realtek/r8169.c

index 676a96e..631ee93 100644 (file)
@@ -5886,6 +5886,7 @@ static int rtl8169_runtime_idle(struct device *device)
        struct net_device *dev = pci_get_drvdata(pdev);
        struct rtl8169_private *tp = netdev_priv(dev);
 
+       __rtl8169_check_link_status(dev, tp, tp->mmio_addr, true);
        return tp->TxDescArray ? -EBUSY : 0;
 }