On Sat, 2 Jun 2007, Michael Hanselmann wrote:

> On Fri, Jun 01, 2007 at 10:19:30AM -0400, Alan Stern wrote:
> > > @@ -779,7 +790,11 @@ static int ohci_restart (struct ohci_hcd
> > >    */
> > >   spin_lock_irq(&ohci->lock);
> > >   disable (ohci);
> > > +
> > > +#ifdef CONFIG_PM
> > >   usb_root_hub_lost_power(ohci_to_hcd(ohci)->self.root_hub);
> > > +#endif
> > > +
> 
> > Suppose CONFIG_PM isn't defined.  How are you going to let usbcore 
> > know about all the old connections which no longer exist?
> 
> You're right, something is wrong there. The patch below uses
> usb_root_hub_lost_power again but disables CONFIG_PM specific code in it
> when CONFIG_PM isn't defined. It seems to work for me with and without
> CONFIG_PM, but I have to confess I might not know enough about Linux'
> USB core. Is it better now?

Well no, even this is still wrong.

What you don't understand is how usb_root_hub_lost_power() works.  It 
doesn't actually do much of anything itself; it simply sets a flag in 
the root hub's device structure.  Then later on, when the hub driver 
is resumed it will see the flag and disconnect all the devices below 
the root hub.

In your case the last step won't work, because the hub driver will
never be resumed since it wasn't suspended to begin with.  You need to
use a completely different approach.  For instance, you could force
ohci-hcd to report connect-change events on all the ports.  Perhaps it
does something like that anyway, in which case you wouldn't have to
worry about it.

Alan Stern

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

Reply via email to