David:

I found part of the source for the trouble I've had with root-hub 
suspend/resume on OHCI.  It's these two lines near the end of 
ohci-hub.c:ohci_hub_suspend():

        if (status == 0)
                hcd->state = HC_STATE_SUSPENDED;

That gets executed even if the root hub was already suspended when the 
function was called, and it is somehow responsible for the driver not 
clearing the interrupt source when OHCI_INTR_RD is received.  Beyond that 
I can't tell what's happening.

However...

This usage reveals a significant conceptual problem, potentially affecting 
all the HCDs.  Namely,

        Does hcd->state describe the state of the host controller
        device or the state of the root-hub device?

I've been assuming all along that it describes the host controller --
after all, we already have hcd->self.root_hub->state to describe the root
hub -- but the OHCI code appears to adopt the other interpretation.  The
way hcd->state is used in usbcore is rather mixed up.  For example,
consider this extract from hcd-pci.c:usb_hcd_pci_suspend():

        switch (hcd->state) {

        /* entry if root hub wasn't yet suspended ... from sysfs,
         * without autosuspend, or if USB_SUSPEND isn't configured.
         */
        case HC_STATE_RUNNING:
                hcd->state = HC_STATE_QUIESCING;
                retval = hcd->driver->suspend (hcd, message);

The comment indicates that hcd->state refers to the root hub, but the code 
calls the suspend routine for the host controller.  (And incidentally, it 
should check that the callback pointer isn't NULL...)

Evidently this confusion needs to be straightened out.  I wouldn't be 
surprised if it's responsible for some other odd things we've been seeing.

Alan Stern



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to