> > > Apparently, there's a window when OHCI is shut down, when we shut the
> > > controller down and freed hcca, but did not release the IRQ. On a shared
> > > IRQ, some other device interrupts, and we oops referring to hcca.
> > >
> > > The attached patch looks like a ham-fisted way to fix this ...
> > 
> > Indeed.  Did you try just freeing the IRQ in ohci_stop(), and setting
> > hcd->irq = -1 to tell usbcore not do free it again?
>
> This seems an underhanded techniqe, when a framework subdrivers go
> up a layer and poke into the framework's internal state. However, if
> really think that it's the way to go, I suppose I can try it.

The point of a driver framework is to make drivers work better, in close
collaboration with those drivers, and by that metric this isn't underhanded
at all.  After all, that's why it already checks for valid IRQs... not all
HCDs can afford to let that framework allocate/manage them.

If you look at the musb_hdrc driver [1], you'd have noticed that it's one
example of an HCD that can't rely on the HCD framework for IRQ management. 
The driver must run in three modes -- host-only, peripheral-only, and OTG
(host _and_ peripheral), and the IRQ is managed the same in all cases.


The HCD framework does need some improvements in how HCDs start up and
shut down; it didn't quite generalize enough I think, which is sort of
understandable given how it happened in the first place ... generalizing
from multiple HCDs that didn't act the same and weren't entirely correct.
At this point they act a lot more similar and more correct, so maybe the
improvements could happen.

If you wanted to try an approach you won't want to call "ham-fisted" or
"under-handed" (what is it with hands in your metaphors?) maybe consider
tweaking that.   Maybe a lifecycle model more like:

        hcd->init()     ... does all run-once setup/allocation
                                --> renames reset()
        hcd->start()    ... as today
        hcd->stop()     ... as today, but leaves resoures allocated
        hcd->destroy()  ... reverses init()
                                --> NEW

with e.g. irqs optionally requested after init() and freed before destroy().
That should help clean out some of the asymmetry in that framework, which
among other things makes it hard to just stop() an hcd than start() it
up again.

- Dave

[1] http://source.mvista.com/git/gitweb.cgi?p=linux-omap-2.6.git;a=summary
    ... browse the tree at drivers/usb/musb, irq setup in plat_uds.c


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to