On Sun, 21 Sep 2003, David Brownell wrote:
Why was this routine called twice? (Don't be fooled by the timestamps; I think the "suspend D4 --> D3" message was created during the suspend but not read by syslogd until after the resume.)
That's happened for as long as I remember (2.4 also).
Still seems buglike to me, maybe 2.6 will finally squish it...
Well, the code path is easy enough to find. If you look at suspend() in
arch/i386/kernel/apm.c, you'll see calls to pm_send_all() and
device_suspend(). They both end up filtering down to the USB HC drivers. The bad one is pm_send_all(); it comes too soon.
By the way, David, apparently core/hcd-pci.c wants the HC drivers to set the hcd state to USB_STATE_SUSPENDED, but a simple grep shows that neither the EHCI nor the OHCI driver does so. That certainly looks like an oversight, though I'm not sure in which source file.
Meanwhile, here's a simple patch to improve logging during suspend and
resume. Greg, if David approves please apply it.