[RFC PATCH 15/39] staging: comedi: usbduxfast: remove 'probed' from private data

H Hartley Sweeten hsweeten at visionengravers.com
Wed May 1 22:23:15 UTC 2013


The 'probed' flag in the private data was used to handle the
disconnect between the usb (*probe) and the comedi_driver
(*auto_attach) so that if the comedi_driver was attached without
an associated usb_device the subdevice functions would return
-ENODEV.

Now that the usb_driver (*probe) is part of the comedi_driver
(*auto_attach), the comedi_driver can only attach if the usb
device is present.

Remove the unnecessary variable from the private data and its
uses in the driver.

Signed-off-by: H Hartley Sweeten <hsweeten at visionengravers.com>
Cc: Ian Abbott <abbotti at mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh at linuxfonudation.org>
---
 drivers/staging/comedi/drivers/usbduxfast.c | 25 -------------------------
 1 file changed, 25 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c
index 6de4957..b9adf95 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -152,7 +152,6 @@ static const struct comedi_lrange range_usbduxfast_ai_range = {
  */
 struct usbduxfast_private {
 	int attached;		/* is attached? */
-	int probed;		/* is it associated with a subdevice? */
 	struct usb_device *usb;	/* pointer to the usb-device */
 	struct urb *urbIn;	/* BULK-transfer handling: urb */
 	int8_t *transfer_buffer;
@@ -251,10 +250,6 @@ static int usbduxfast_ai_cancel(struct comedi_device *dev,
 		return -EFAULT;
 	}
 	down(&devpriv->sem);
-	if (!devpriv->probed) {
-		up(&devpriv->sem);
-		return -ENODEV;
-	}
 	/* unlink */
 	ret = usbduxfast_ai_stop(devpriv, 1);
 	up(&devpriv->sem);
@@ -479,14 +474,10 @@ static int usbduxfast_ai_cmdtest(struct comedi_device *dev,
 				 struct comedi_subdevice *s,
 				 struct comedi_cmd *cmd)
 {
-	struct usbduxfast_private *devpriv = dev->private;
 	int err = 0;
 	long int steps, tmp;
 	int minSamplPer;
 
-	if (!devpriv->probed)
-		return -ENODEV;
-
 	/* Step 1 : check if triggers are trivially valid */
 
 	err |= cfc_check_trigger_src(&cmd->start_src,
@@ -583,10 +574,6 @@ static int usbduxfast_ai_inttrig(struct comedi_device *dev,
 		return -EFAULT;
 
 	down(&devpriv->sem);
-	if (!devpriv->probed) {
-		up(&devpriv->sem);
-		return -ENODEV;
-	}
 
 	if (trignum != 0) {
 		dev_err(dev->class_dev, "%s: invalid trignum\n", __func__);
@@ -635,10 +622,6 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev,
 		return -EFAULT;
 
 	down(&devpriv->sem);
-	if (!devpriv->probed) {
-		up(&devpriv->sem);
-		return -ENODEV;
-	}
 	if (devpriv->ai_cmd_running) {
 		dev_err(dev->class_dev,
 			"ai_cmd not possible. Another ai_cmd is running.\n");
@@ -1086,10 +1069,6 @@ static int usbduxfast_ai_insn_read(struct comedi_device *dev,
 	}
 
 	down(&devpriv->sem);
-	if (!devpriv->probed) {
-		up(&devpriv->sem);
-		return -ENODEV;
-	}
 	if (devpriv->ai_cmd_running) {
 		dev_err(dev->class_dev,
 			"ai_insn_read not possible. Async Command is running.\n");
@@ -1345,8 +1324,6 @@ static int usbduxfast_auto_attach(struct comedi_device *dev,
 	if (!devpriv->transfer_buffer)
 		return -ENOMEM;
 
-	devpriv->probed = 1;
-
 	/*
 	 * Request, and upload, the firmware so we can
 	 * complete the comedi_driver (*auto_attach).
@@ -1375,8 +1352,6 @@ static void usbduxfast_detach(struct comedi_device *dev)
 	if (devpriv->intf)
 		usb_set_intfdata(devpriv->intf, NULL);
 
-	devpriv->probed = 0;
-
 	if (devpriv->urbIn) {
 		/* waits until a running transfer is over */
 		usb_kill_urb(devpriv->urbIn);
-- 
1.8.1.4




More information about the devel mailing list