linux/drivers/usb
Hans de Goede 0837e7e527 usbfs: Add a new disconnect-and-claim ioctl (v2)
Apps which deal with devices which also have a kernel driver, need to do
the following:
1) Check which driver is attached, so as to not detach the wrong driver
   (ie detaching usbfs while another instance of the app is using the device)
2) Detach the kernel driver
3) Claim the interface

Where moving from one step to the next for both 1-2 and 2-3 consists of
a (small) race window. So currently such apps are racy and people just live
with it.

This patch adds a new ioctl which makes it possible for apps to do this
in a race free manner. For flexibility apps can choose to:
1) Specify the driver to disconnect
2) Specify to disconnect any driver except for the one named by the app
3) Disconnect any driver

Note that if there is no driver attached, the ioctl will just act like the
regular claim-interface ioctl, this is by design, as returning an error for
this condition would open a new bag of race-conditions.

Changes in v2:
-Fix indentation of if blocks where the condition spans multiple lines

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 11:10:37 -07:00
..
atm USB: atm: ueagle-atm: Declare MODULE_FIRMWARE usage 2012-08-15 15:17:40 -07:00
c67x00 usb: convert drivers/usb/* to use module_platform_driver() 2011-11-28 06:48:32 +09:00
chipidea usb: chipidea: fix and improve dependencies if usb host or gadget support is built as module 2012-08-10 11:46:04 -07:00
class usb: cdc-acm: remove duplicated include from cdc-acm.c 2012-09-05 16:52:09 -07:00
core usbfs: Add a new disconnect-and-claim ioctl (v2) 2012-09-10 11:10:37 -07:00
dwc3 usb: dwc3: patches for v3.6 merge window 2012-07-05 15:15:38 -07:00
early KGDB/KDB/usb-dbgp fixes and cleanups 2012-08-03 10:53:47 -07:00
gadget drivers/usb/gadget/lpc32xx_udc.c: adjust inconsistent IS_ERR and PTR_ERR 2012-09-05 16:52:09 -07:00
host USB: FHCI: use list_move_tail instead of list_del/list_add_tail 2012-09-05 16:55:18 -07:00
image USB: mdc800.c: remove dbg() usage 2012-05-01 21:33:50 -07:00
misc Merge v3.6-rc3 into usb-next 2012-08-27 07:15:30 -07:00
mon usb: Add export.h for EXPORT_SYMBOL/THIS_MODULE where needed 2011-10-31 19:31:25 -04:00
musb usb: musb: reorder runtime pm call 2012-08-03 09:30:44 +03:00
otg This patch series contains a major revamp of how we collect entropy 2012-07-31 19:07:42 -07:00
phy USB: isp1301: Remove unused static array and define 2012-09-05 16:52:08 -07:00
renesas_usbhs usb: renesas_usbhs: fixup DMA transport data alignment 2012-09-05 16:52:08 -07:00
serial USB: cp210x: remove useless set memory to zero use memset() 2012-09-05 16:58:30 -07:00
storage usb: remove libusual 2012-09-05 17:21:36 -07:00
wusbcore drivers/usb/wusbcore/wa-hc.c: fix error return code 2012-08-15 15:17:40 -07:00
Kconfig USB: PLAT_ORION fulfils USB_ARCH_HAS_EHCI 2012-09-07 08:54:38 -07:00
Makefile usb: phy: Fix Kconfig dependency for Phy drivers 2012-06-26 16:14:33 -07:00
README
usb-common.c usb: Provide usb_speed_string() function 2011-09-18 01:29:04 -07:00
usb-skeleton.c USB: usb-skeleton.c: remove err() usage 2012-04-27 11:24:45 -07: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.