On Tue, 16 Sep 2003, David Brownell wrote: > > > @@ -2531,6 +2531,7 @@ > > if (uhci_active(uhci)) > > suspend_hc(uhci); > > uhci->state = UHCI_SUSPENDED_PM; > > + uhci->hcd.state = USB_STATE_SUSPENDED; > > } > > up(&uhci->state_mutex); > > return rc; > > > > > I meant to ask ... why don't you just use uhci->hcd.state > exclusively?
That's a good question. I wanted to distinguish between two types of suspended states. One is where the bus is suspended because no devices are attached, the other is where the PM software has told us to suspend. It's necessary to make this distinction, because when a device is plugged in we should wake up from the first type of suspend but not from the second. Also, I wanted to distinguish between two types of running states: the normal state and a "grace" period (lasting only 1 second) that goes between the normal state and the no-devices suspend. The reason for the grace period is to prevent bouncing between suspended and running during the brief interval when a device is being attached or unplugged. Bus signals rapidly turning on and off due to connections intermittently getting opened and closed can cause that sort of bouncing. So now when the last device is unplugged the driver starts the "grace" period, and if there haven't been any connect signals after a second has passed, it moves on to the suspended state. (If a connect signal does arrive, it moves back to the normal running state.) Finally, I wanted to distinguish between several stages of resuming from a suspend. Since the UHCI spec requires delays of tens of milliseconds during the wakeup procedure, and since a wakeup can be initiated during interrupt processing, this was the only way to avoid unreasonably long delays in an interrupt handler. Since uhci->hcd.state doesn't permit making any of these distinctions, I had to invent my own state variable. Alan Stern ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel