[PATCH 15/32] staging: comedi: vmk80xx: remove private data 'attached'

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

 



The 'attached' flag in the private data is set after the comedi_driver
(*auto_attach) function has completed successfully.

The only places it's checked are in rudimentary_check(), which does
some basic sanity checks before doing any of the subdevice operations,
and vmk80xx_auto_attach(), which is the comedi_driver (*auto_attach)
function.

The (*auto_attach) function can only be called as the result of a
successfull usb_driver (*probe). Part of the probe is to locate a
free slot in the static private data array. All free slots are
initialized to '0' so the 'attached' flag will always be cleared.

Remove the unneccessary 'attached' flag in the private data.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/vmk80xx.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c
index a9aa988..00a115d 100644
--- a/drivers/staging/comedi/drivers/vmk80xx.c
+++ b/drivers/staging/comedi/drivers/vmk80xx.c
@@ -210,7 +210,6 @@ struct vmk80xx_private {
 	unsigned char *usb_rx_buf;
 	unsigned char *usb_tx_buf;
 	unsigned long flags;
-	int attached;
 };
 
 static struct vmk80xx_private vmb[VMK80XX_MAX_BOARDS];
@@ -528,8 +527,6 @@ static int rudimentary_check(struct vmk80xx_private *devpriv, int dir)
 {
 	if (!devpriv)
 		return -EFAULT;
-	if (!devpriv->attached)
-		return -ENODEV;
 	if (dir & DIR_IN) {
 		if (test_bit(TRANS_IN_BUSY, &devpriv->flags))
 			return -EBUSY;
@@ -1280,8 +1277,6 @@ static int vmk80xx_attach_common(struct comedi_device *dev,
 		s->insn_write = vmk80xx_pwm_winsn;
 	}
 
-	devpriv->attached = 1;
-
 	up(&devpriv->limit_sem);
 
 	return 0;
@@ -1300,8 +1295,6 @@ static int vmk80xx_auto_attach(struct comedi_device *dev,
 			break;
 	if (i == VMK80XX_MAX_BOARDS)
 		ret = -ENODEV;
-	else if (vmb[i].attached)
-		ret = -EBUSY;
 	else
 		ret = vmk80xx_attach_common(dev, &vmb[i]);
 	mutex_unlock(&glb_mutex);
-- 
1.8.1.1.293.gfe73786

_______________________________________________
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