Re: usb autosuspend is history after S2R (also on 2.6.31; UVC?)

From: Francois Romieu
Date: Wed Sep 16 2009 - 16:38:37 EST


Andreas Mohr <andi@xxxxxxxx> :
[...]
> Wait, you mean this is the patch to fix it that you created just now,
> and it's that easy?

I can not exclude that it will not swap a settings loss problem for
a (new) link loss after resume one or some completely random crash
but it deserves to be tested, yes.

> I'd have expected needing to fiddle with PHY power-management registers
> and such stuff (while remembering pre-suspend status)
> upon resume() handlers.

The current driver does not play directly with the PHY during
suspend / resume.

/me wonders...

Can you try the patch below too ? A PHY reset will probably be required
too now.

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 50c6a3c..116797f 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -3934,11 +3934,19 @@ static struct net_device_stats *rtl8169_get_stats(struct net_device *dev)

static void rtl8169_net_suspend(struct net_device *dev)
{
+ struct rtl8169_private *tp = netdev_priv(dev);
+
if (!netif_running(dev))
return;

netif_device_detach(dev);
netif_stop_queue(dev);
+
+ if (!(tp->features & RTL_FEATURE_WOL)) {
+ void __iomem *ioaddr = tp->mmio_addr;
+
+ mdio_patch(ioaddr, MII_BMCR, BMCR_PDOWN);
+ }
}

#ifdef CONFIG_PM
@@ -3957,13 +3965,21 @@ static int rtl8169_resume(struct device *device)
{
struct pci_dev *pdev = to_pci_dev(device);
struct net_device *dev = pci_get_drvdata(pdev);
+ struct rtl8169_private *tp = netdev_priv(dev);

if (!netif_running(dev))
goto out;

netif_device_attach(dev);
+ netif_wake_queue(dev);

- rtl8169_schedule_work(dev, rtl8169_reset_task);
+ if (!(tp->features & RTL_FEATURE_WOL)) {
+ void __iomem *ioaddr = tp->mmio_addr;
+ unsigned int val;
+
+ val = mdio_read(ioaddr, MII_BMCR) & ~BMCR_PDOWN;
+ mdio_write(ioaddr, MII_BMCR, val & 0xffff);
+ }
out:
return 0;
}

> And sorry for not reporting it earlier (provoking that "Stealth tester"
> above, right?), but I had kept tabs on it.

No problem, really. :o)

--
Ueimor
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/