diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2013-02-05 17:18:04 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-02-05 18:07:09 -0800 |
commit | 9377b9234f159773a53c7277559cc24397dd9803 (patch) | |
tree | 53e0ad1eccce6278481e558cbd8f21c735892b7a | |
parent | 07b502f50bfc290222fe4032501619a44bbd777e (diff) | |
download | op-kernel-dev-9377b9234f159773a53c7277559cc24397dd9803.zip op-kernel-dev-9377b9234f159773a53c7277559cc24397dd9803.tar.gz |
staging: comedi: vmk80xx: move usb_driver (*disconnect) code
The usb_driver (*disconnect) in this driver calls the comedi core
comedi_usb_auto_unconfig() which calls the comedi_driver (*detach).
Move the code in the (*disconnect) to the (*detach) to get all the
disconnect/detach in one place.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/drivers/vmk80xx.c | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c index f5a999c..8cd4971 100644 --- a/drivers/staging/comedi/drivers/vmk80xx.c +++ b/drivers/staging/comedi/drivers/vmk80xx.c @@ -1214,12 +1214,26 @@ static void vmk80xx_detach(struct comedi_device *dev) { struct vmk80xx_usb *usb = dev->private; - if (usb) { - down(&usb->limit_sem); - dev->private = NULL; - usb->attached = 0; - up(&usb->limit_sem); - } + if (!usb) + return; + + mutex_lock(&glb_mutex); + down(&usb->limit_sem); + + dev->private = NULL; + + usb->attached = 0; + usb->probed = 0; + usb_set_intfdata(usb->intf, NULL); + + usb_kill_anchored_urbs(&usb->rx_anchor); + usb_kill_anchored_urbs(&usb->tx_anchor); + + kfree(usb->usb_rx_buf); + kfree(usb->usb_tx_buf); + + up(&usb->limit_sem); + mutex_unlock(&glb_mutex); } static struct comedi_driver vmk80xx_driver = { @@ -1382,30 +1396,7 @@ error: static void vmk80xx_usb_disconnect(struct usb_interface *intf) { - struct vmk80xx_usb *dev = usb_get_intfdata(intf); - - if (!dev) - return; - comedi_usb_auto_unconfig(intf); - - mutex_lock(&glb_mutex); - down(&dev->limit_sem); - - dev->probed = 0; - usb_set_intfdata(dev->intf, NULL); - - usb_kill_anchored_urbs(&dev->rx_anchor); - usb_kill_anchored_urbs(&dev->tx_anchor); - - kfree(dev->usb_rx_buf); - kfree(dev->usb_tx_buf); - - dev_info(&intf->dev, "board #%d [%s] now detached\n", - dev->count, dev->board.name); - - up(&dev->limit_sem); - mutex_unlock(&glb_mutex); } static const struct usb_device_id vmk80xx_usb_id_table[] = { |