[RFC PATCH 21/39] staging: comedi: usbduxfast: remove 'intf' from the private data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/usbduxfast.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c
index f237019..e354947 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -155,7 +155,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 */
@@ -1242,8 +1241,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;
@@ -1279,7 +1277,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);
@@ -1324,6 +1321,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)
@@ -1331,8 +1329,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 */
-- 
1.8.1.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux