linux/drivers/usb
Alan Stern 9b37596a2e USB: move usbcore away from hcd->state
The hcd->state variable is a disaster.  It's not clearly owned by
either usbcore or the host controller drivers, and they both change it
from time to time, potentially stepping on each other's toes.  It's
not protected by any locks.  And there's no mechanism to prevent it
from going through an invalid transition.

This patch (as1451) takes a first step toward fixing these problems.
As it turns out, usbcore uses hcd->state for essentially only two
things: checking whether the controller's root hub is running and
checking whether the controller has died.  Therefore the patch adds
two new atomic bitflags to the hcd structure, to store these pieces of
information.  The new flags are used only by usbcore, and a private
spinlock prevents invalid combinations (a dead controller's root hub
cannot be running).

The patch does not change the places where usbcore sets hcd->state,
since HCDs may depend on them.  Furthermore, there is one place in
usb_hcd_irq() where usbcore still must use hcd->state: An HCD's
interrupt handler can implicitly indicate that the controller died by
setting hcd->state to HC_STATE_HALT.  Nevertheless, the new code is a
big improvement over the current code.

The patch makes one other change.  The hcd_bus_suspend() and
hcd_bus_resume() routines now check first whether the host controller
has died; if it has then they return immediately without calling the
HCD's bus_suspend or bus_resume methods.

This fixes the major problem reported in Bugzilla #29902: The system
fails to suspend after a host controller dies during system resume.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Alex Terekhov <a.terekhov@gmail.com>
CC: <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-03-07 12:14:06 -08:00
..
atm USB: ueagle-atm: use system_wq instead of dedicated workqueues 2011-01-22 19:38:26 -08:00
c67x00 usb: makefile cleanup 2010-10-22 10:22:07 -07:00
class USB: cdc-acm: Adding second ACM channel support for Nokia N8 2011-02-04 12:38:14 -08:00
core USB: move usbcore away from hcd->state 2011-03-07 12:14:06 -08:00
early USB: ehci-dbgp: fix typo in startup message 2011-01-22 19:35:40 -08:00
gadget USB: Remove unused is_iso from fsl_udc_core.c 2011-03-02 19:52:29 -05:00
host usb: EHCI, OHCI: Add configuration for the SH USB controller 2011-03-01 16:01:46 -05:00
image SCSI host lock push-down 2010-11-16 13:33:23 -08:00
misc Merge 2.6.38-rc5 into usb-next 2011-02-17 09:56:55 -08:00
mon USB: usbmon: fix-up docs and text API for sparse ISO 2011-02-04 11:46:57 -08:00
musb usb: musb: tusb: Fix possible null pointer dereference in tusb6010_omap.c 2011-03-01 12:35:23 +02:00
otg usb: otg: TWL4030: Update the last_event variable. 2011-03-01 11:35:27 +02:00
serial USB: Remove unused timeout from io_edgeport.c 2011-03-02 19:52:30 -05:00
storage USB: Remove delay_t unused variable from sierra_ms.c driver initialisation code 2011-03-02 19:52:29 -05:00
wusbcore wusb: fix find_first_zero_bit() return value check 2011-03-02 19:52:28 -05:00
Kconfig Merge branch 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6 2011-01-07 13:16:28 -08:00
Makefile USB: drivers/usb/Makefile: conditionally descend to 'early' 2010-08-10 14:35:38 -07:00
README
usb-skeleton.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00

To understand all the Linux-USB framework, you'll use these resources:

    * This source code.  This is necessarily an evolving work, and
      includes kerneldoc that should help you get a current overview.
      ("make pdfdocs", and then look at "usb.pdf" for host side and
      "gadget.pdf" for peripheral side.)  Also, Documentation/usb has
      more information.

    * The USB 2.0 specification (from www.usb.org), with supplements
      such as those for USB OTG and the various device classes.
      The USB specification has a good overview chapter, and USB
      peripherals conform to the widely known "Chapter 9".

    * Chip specifications for USB controllers.  Examples include
      host controllers (on PCs, servers, and more); peripheral
      controllers (in devices with Linux firmware, like printers or
      cell phones); and hard-wired peripherals like Ethernet adapters.

    * Specifications for other protocols implemented by USB peripheral
      functions.  Some are vendor-specific; others are vendor-neutral
      but just standardized outside of the www.usb.org team.

Here is a list of what each subdirectory here is, and what is contained in
them.

core/		- This is for the core USB host code, including the
		  usbfs files and the hub class driver ("khubd").

host/		- This is for USB host controller drivers.  This
		  includes UHCI, OHCI, EHCI, and others that might
		  be used with more specialized "embedded" systems.

gadget/		- This is for USB peripheral controller drivers and
		  the various gadget drivers which talk to them.


Individual USB driver directories.  A new driver should be added to the
first subdirectory in the list below that it fits into.

image/		- This is for still image drivers, like scanners or
		  digital cameras.
../input/	- This is for any driver that uses the input subsystem,
		  like keyboard, mice, touchscreens, tablets, etc.
../media/	- This is for multimedia drivers, like video cameras,
		  radios, and any other drivers that talk to the v4l
		  subsystem.
../net/		- This is for network drivers.
serial/		- This is for USB to serial drivers.
storage/	- This is for USB mass-storage drivers.
class/		- This is for all USB device drivers that do not fit
		  into any of the above categories, and work for a range
		  of USB Class specified devices. 
misc/		- This is for all USB device drivers that do not fit
		  into any of the above categories.