diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2013-05-20 14:27:13 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-05-21 10:59:11 -0700 |
commit | e23322e43a271cb8ebf1bc750dffffeebfe46043 (patch) | |
tree | 31c700997dd984735fbe34c340e72d6f541e2f01 | |
parent | db4c3eb795696b7f6132d183b1bbe561b54c98c6 (diff) | |
download | linux-e23322e43a271cb8ebf1bc750dffffeebfe46043.tar.bz2 |
staging: comedi: vmk80xx: remove usb_interface from private data
This driver uses the comedi auto attach mechanism so the comedi_device
will always have an associated usb_interface and usb_device.
Remove the unnecessary checks if the comedi_device has a usb_interface
attached. This also allows removing the usb_interface from the private
data.
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 | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c index 2cf0e50592cf..0ab04c0dd410 100644 --- a/drivers/staging/comedi/drivers/vmk80xx.c +++ b/drivers/staging/comedi/drivers/vmk80xx.c @@ -154,7 +154,6 @@ static const struct vmk80xx_board vmk80xx_boardinfo[] = { }; struct vmk80xx_private { - struct usb_interface *intf; struct usb_endpoint_descriptor *ep_rx; struct usb_endpoint_descriptor *ep_tx; struct firmware_version fw; @@ -252,9 +251,6 @@ static int vmk80xx_read_packet(struct comedi_device *dev) struct usb_endpoint_descriptor *ep; unsigned int pipe; - if (!devpriv->intf) - return -ENODEV; - if (devpriv->model == VMK8061_MODEL) { vmk80xx_do_bulk_msg(dev); return 0; @@ -274,9 +270,6 @@ static int vmk80xx_write_packet(struct comedi_device *dev, int cmd) struct usb_endpoint_descriptor *ep; unsigned int pipe; - if (!devpriv->intf) - return -ENODEV; - devpriv->usb_tx_buf[0] = cmd; if (devpriv->model == VMK8061_MODEL) { @@ -729,7 +722,7 @@ static int vmk80xx_pwm_insn_write(struct comedi_device *dev, static int vmk80xx_find_usb_endpoints(struct comedi_device *dev) { struct vmk80xx_private *devpriv = dev->private; - struct usb_interface *intf = devpriv->intf; + struct usb_interface *intf = comedi_to_usb_interface(dev); struct usb_host_interface *iface_desc = intf->cur_altsetting; struct usb_endpoint_descriptor *ep_desc; int i; @@ -887,7 +880,6 @@ static int vmk80xx_auto_attach(struct comedi_device *dev, return -ENOMEM; dev->private = devpriv; - devpriv->intf = intf; devpriv->model = boardinfo->model; ret = vmk80xx_find_usb_endpoints(dev); @@ -920,6 +912,7 @@ static int vmk80xx_auto_attach(struct comedi_device *dev, static void vmk80xx_detach(struct comedi_device *dev) { + struct usb_interface *intf = comedi_to_usb_interface(dev); struct vmk80xx_private *devpriv = dev->private; if (!devpriv) @@ -927,7 +920,7 @@ static void vmk80xx_detach(struct comedi_device *dev) down(&devpriv->limit_sem); - usb_set_intfdata(devpriv->intf, NULL); + usb_set_intfdata(intf, NULL); kfree(devpriv->usb_rx_buf); kfree(devpriv->usb_tx_buf); |