Skip to content

Commit

Permalink
staging: comedi: usbduxfast: remove usbduxfast_attach
Browse files Browse the repository at this point in the history
This driver originally used the 'attach' method in order to get
the firmware for the device from the comedi_config utility. It
now uses request_firmware_nowait() in the usb_driver probe to
get this firmware.

Since this driver has an 'attach_usb' method in the comedi_driver,
the 'attach' method can be removed because it is now optional.

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>
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Sep 21, 2012
1 parent 453443f commit 4e5ba2f
Showing 1 changed file with 3 additions and 51 deletions.
54 changes: 3 additions & 51 deletions drivers/staging/comedi/drivers/usbduxfast.c
Original file line number Diff line number Diff line change
Expand Up @@ -1430,20 +1430,15 @@ static void tidy_up(struct usbduxfastsub_s *udfs)
udfs->ai_cmd_running = 0;
}

/* common part of attach and attach_usb */
static int usbduxfast_attach_common(struct comedi_device *dev,
struct usbduxfastsub_s *udfs,
void *aux_data, int aux_len)
struct usbduxfastsub_s *udfs)
{
int ret;
struct comedi_subdevice *s;

down(&udfs->sem);
/* pointer back to the corresponding comedi device */
udfs->comedidev = dev;
/* trying to upload the firmware into the chip */
if (aux_data)
firmwareUpload(udfs, aux_data, aux_len);
dev->board_name = "usbduxfast";
ret = comedi_alloc_subdevices(dev, 1);
if (ret) {
Expand Down Expand Up @@ -1485,48 +1480,6 @@ static int usbduxfast_attach_common(struct comedi_device *dev,
return 0;
}

/* is called for COMEDI_DEVCONFIG ioctl (when comedi_config is run) */
static int usbduxfast_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
{
int ret;
int index;
int i;
void *aux_data;
int aux_len;

dev->private = NULL;

aux_data = comedi_aux_data(it->options, 0);
aux_len = it->options[COMEDI_DEVCONF_AUX_DATA_LENGTH];
if (aux_data == NULL)
aux_len = 0;
else if (aux_len == 0)
aux_data = NULL;
down(&start_stop_sem);
/*
* find a valid device which has been detected by the
* probe function of the usb
*/
index = -1;
for (i = 0; i < NUMUSBDUXFAST; i++) {
if (usbduxfastsub[i].probed && !usbduxfastsub[i].attached) {
index = i;
break;
}
}
if (index < 0) {
dev_err(dev->class_dev,
"usbduxfast: error: attach failed, no usbduxfast devs connected to the usb bus.\n");
ret = -ENODEV;
} else
ret = usbduxfast_attach_common(dev, &usbduxfastsub[index],
aux_data, aux_len);
up(&start_stop_sem);
return ret;
}

/* is called from comedi_usb_auto_config() */
static int usbduxfast_attach_usb(struct comedi_device *dev,
struct usb_interface *uinterf)
{
Expand All @@ -1545,7 +1498,7 @@ static int usbduxfast_attach_usb(struct comedi_device *dev,
"usbduxfast: error: attach_usb failed, already attached\n");
ret = -ENODEV;
} else
ret = usbduxfast_attach_common(dev, udfs, NULL, 0);
ret = usbduxfast_attach_common(dev, udfs);
up(&start_stop_sem);
return ret;
}
Expand All @@ -1568,9 +1521,8 @@ static void usbduxfast_detach(struct comedi_device *dev)
static struct comedi_driver usbduxfast_driver = {
.driver_name = "usbduxfast",
.module = THIS_MODULE,
.attach = usbduxfast_attach,
.detach = usbduxfast_detach,
.attach_usb = usbduxfast_attach_usb,
.detach = usbduxfast_detach,
};

static void usbduxfast_firmware_request_complete_handler(const struct firmware
Expand Down

0 comments on commit 4e5ba2f

Please sign in to comment.