aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers.c
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2013-11-08 15:03:28 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-11-11 16:16:44 -0800
commitd19db51a0eeb659cd924a9d08b20a2ed4ee46b15 (patch)
treebed15b7a8d0dd01f0d5dfbffced7e0282c5ae65a /drivers/staging/comedi/drivers.c
parentstaging: comedi: wake up async waiters when become non-busy (diff)
downloadlinux-dev-d19db51a0eeb659cd924a9d08b20a2ed4ee46b15.tar.xz
linux-dev-d19db51a0eeb659cd924a9d08b20a2ed4ee46b15.zip
staging: comedi: cancel commands before detaching device
The comedi core module's handling of the `COMEDI_DEVCONFIG` ioctl will not allow a device to be detached if it is busy. However, comedi devices can also be auto-detached due to a removal of a hardware device. One of the things we should do in that case is cancel any asynchronous commands that are running. Add a new function `comedi_device_cancel_all()` to do that and call it from `comedi_device_detach()`. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/drivers.c')
-rw-r--r--drivers/staging/comedi/drivers.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index 1f44f2939f6a..4f727731a72d 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -133,6 +133,7 @@ static void comedi_device_detach_cleanup(struct comedi_device *dev)
void comedi_device_detach(struct comedi_device *dev)
{
+ comedi_device_cancel_all(dev);
down_write(&dev->attach_lock);
dev->attached = false;
if (dev->driver)