From: H Hartley Sweeten Date: Tue, 14 May 2013 20:34:54 +0000 (-0700) Subject: staging: comedi: usbduxfast: remove 'intf' from the private data X-Git-Tag: firefly_0821_release~176^2~5845^2~654 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a71a65b1d68c145a914cdc05d6f85372a58e71df;p=firefly-linux-kernel-4.4.55.git staging: comedi: usbduxfast: remove 'intf' from the private data The usb_interface pointer is already saved in the comedi_device by the comedi core. Remove the pointer from the private data and use comedi_to_usb_interface() to get the usb_interface when needed. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index c87cc5ac1342..e8dab2fe0705 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -152,7 +152,6 @@ struct usbduxfast_private { struct urb *urbIn; /* BULK-transfer handling: urb */ int8_t *transfer_buffer; int16_t *insnBuffer; /* input buffer for single insn */ - struct usb_interface *intf; /* interface structure */ short int ai_cmd_running; /* asynchronous command is running */ short int ai_continous; /* continous acquisition */ long int ai_sample_count; /* number of samples to acquire */ @@ -1239,8 +1238,7 @@ static int usbduxfast_attach_common(struct comedi_device *dev) static int usbduxfast_request_firmware(struct comedi_device *dev) { - struct usbduxfast_private *devpriv = dev->private; - struct usb_interface *intf = devpriv->intf; + struct usb_interface *intf = comedi_to_usb_interface(dev); struct usb_device *usb = interface_to_usbdev(intf); const struct firmware *fw; int ret; @@ -1276,7 +1274,6 @@ static int usbduxfast_auto_attach(struct comedi_device *dev, sema_init(&devpriv->sem, 1); devpriv->usb = usb; - devpriv->intf = intf; usb_set_intfdata(intf, devpriv); devpriv->dux_commands = kmalloc(SIZEOFDUXBUFFER, GFP_KERNEL); @@ -1321,6 +1318,7 @@ static int usbduxfast_auto_attach(struct comedi_device *dev, static void usbduxfast_detach(struct comedi_device *dev) { + struct usb_interface *intf = comedi_to_usb_interface(dev); struct usbduxfast_private *devpriv = dev->private; if (!devpriv) @@ -1328,8 +1326,7 @@ static void usbduxfast_detach(struct comedi_device *dev) down(&devpriv->sem); - if (devpriv->intf) - usb_set_intfdata(devpriv->intf, NULL); + usb_set_intfdata(intf, NULL); if (devpriv->urbIn) { /* waits until a running transfer is over */