1
0
Fork 0
alistair23-linux/include
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
..
acpi Merge branches 'delete-gts-bfs', 'misc', 'novell-bugzilla-757888-numa' and 'osc-pcie' into base 2012-08-03 00:31:23 -04:00
asm-generic mutex: Place lock in contended state after fastpath_lock failure 2012-08-13 18:46:54 +02:00
crypto
drm drm: Remove two unused fields from struct drm_display_mode 2012-08-22 09:27:27 +10:00
keys
linux usbfs: Add a new disconnect-and-claim ioctl (v2) 2012-09-10 11:10:37 -07:00
math-emu
media [media] v4l2: add core support for the new VIDIOC_ENUM_FREQ_BANDS ioctl 2012-07-30 20:23:05 -03:00
memory
misc
mtd
net af_netlink: force credentials passing [CVE-2012-3520] 2012-08-21 14:53:01 -07:00
pcmcia
ras
rdma Merge branches 'cma', 'cxgb4', 'misc', 'mlx4-sriov', 'mlx-cleanups', 'ocrdma' and 'qib' into for-linus 2012-07-22 23:26:17 -07:00
rxrpc
scsi Merge branch 'master' [vanilla Linus master] into libata-dev.git/upstream 2012-07-25 15:58:48 -04:00
sound ASoC: Additional updates for 3.6 2012-08-20 21:26:04 +02:00
target target: Remove unused se_cmd.cmd_spdtl 2012-08-21 14:27:35 -07:00
trace Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2012-08-03 10:57:20 -07:00
video video: da8xx-fb: configure FIFO threshold to reduce underflow errors 2012-07-29 01:11:09 +00:00
xen xen PVonHVM: move shared_info to MMIO before kexec 2012-07-19 15:52:05 -04:00
Kbuild