Re: [PATCH][4/4] usb: use single ohci_start()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sunday 13 January 2008, Magnus Damm wrote:
> usb: use single ohci_start()
> 
> This patch adds adds an ohci_start() function that easily can be shared
> between many ohci drivers. This patch only changes drivers to ohci_start()
> when the driver specific implementation exactly match ohci_start(). It also
> seems popular to sometimes do ohci_init() in .reset instead of .start, and if
> those drivers can be rewritten then it may be possible to use ohci_start()
> in even more drivers.

Actually, the drivers that you made use ohci_start() are the problem ones...
you might get a hint of that because the PCI glue isn't structured that way,
yet that code gets bugfixed quicker than anything else.

Thing is, the reset() entry point is where all the one-time init *should*
happen, and that includes calling ohci_init().  Its name is a historical
goof; it doesn't just reset the hardware any more, that's a side effect.

And the start() entry point is what should be moving from the initialized
but inactive state into the operational state -- what ohci_run() does,
and maybe a bit more.

Whereas, ohci_start() idioms are calling ohci_init() *AND* ohci_run(), but
they should really only be doing the latter as start() entry points.

The situation got bad because of lots of copy'n'paste that was mostly
harmless on embedded hardware that often didn't suffer from the stranger
nuances of HCD lifecycle.  And because some ancient 2.2/2.4 init sequence
code didn't get overhauled for a very long time.  (In fact it's still not
exactly done...)

So, NAK on this one, sorry.  The idea of code reuse is great, but this
is the wrong code to re-use.

- Dave


>  drivers/usb/host/ohci-au1xxx.c  |   24 +-----------------------
>  drivers/usb/host/ohci-ep93xx.c  |   19 +------------------
>  drivers/usb/host/ohci-hcd.c     |   18 ++++++++++++++++++
>  drivers/usb/host/ohci-lh7a404.c |   22 +---------------------
>  drivers/usb/host/ohci-pnx4008.c |   18 +-----------------
>  drivers/usb/host/ohci-pnx8550.c |   24 +-----------------------
>  drivers/usb/host/ohci-ppc-of.c  |   21 +--------------------
>  drivers/usb/host/ohci-ppc-soc.c |   20 +-------------------
>  drivers/usb/host/ohci-s3c2410.c |   21 +--------------------
>  drivers/usb/host/ohci-sa1111.c  |   21 +--------------------
>  drivers/usb/host/ohci-sm501.c   |   19 +------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
linux-usb-devel@xxxxxxxxxxxxxxxxxxxxx
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[Index of Archives]     [Video for Linux]     [Photo]     [Yosemite Forum]     [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [XFree86]     [Devices]     [Big List of Linux Books]

  Powered by Linux