diff options
author | H Hartley Sweeten <hartleys@visionengravers.com> | 2012-09-19 19:20:57 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-21 12:24:16 -0400 |
commit | 4e5ba2f6bd1c480ce6b362a17a6a3456a2354cf0 (patch) | |
tree | d3cee7f6abf55c5aa401b3e85043d5428f7a2868 | |
parent | 453443f32fd8d5fb3da702aa02901297dd4ad51f (diff) |
staging: comedi: usbduxfast: remove usbduxfast_attach
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>
-rw-r--r-- | drivers/staging/comedi/drivers/usbduxfast.c | 54 |
1 files changed, 3 insertions, 51 deletions
diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index 3f68fc396301..0f6c1392f6ce 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c | |||
@@ -1430,10 +1430,8 @@ static void tidy_up(struct usbduxfastsub_s *udfs) | |||
1430 | udfs->ai_cmd_running = 0; | 1430 | udfs->ai_cmd_running = 0; |
1431 | } | 1431 | } |
1432 | 1432 | ||
1433 | /* common part of attach and attach_usb */ | ||
1434 | static int usbduxfast_attach_common(struct comedi_device *dev, | 1433 | static int usbduxfast_attach_common(struct comedi_device *dev, |
1435 | struct usbduxfastsub_s *udfs, | 1434 | struct usbduxfastsub_s *udfs) |
1436 | void *aux_data, int aux_len) | ||
1437 | { | 1435 | { |
1438 | int ret; | 1436 | int ret; |
1439 | struct comedi_subdevice *s; | 1437 | struct comedi_subdevice *s; |
@@ -1441,9 +1439,6 @@ static int usbduxfast_attach_common(struct comedi_device *dev, | |||
1441 | down(&udfs->sem); | 1439 | down(&udfs->sem); |
1442 | /* pointer back to the corresponding comedi device */ | 1440 | /* pointer back to the corresponding comedi device */ |
1443 | udfs->comedidev = dev; | 1441 | udfs->comedidev = dev; |
1444 | /* trying to upload the firmware into the chip */ | ||
1445 | if (aux_data) | ||
1446 | firmwareUpload(udfs, aux_data, aux_len); | ||
1447 | dev->board_name = "usbduxfast"; | 1442 | dev->board_name = "usbduxfast"; |
1448 | ret = comedi_alloc_subdevices(dev, 1); | 1443 | ret = comedi_alloc_subdevices(dev, 1); |
1449 | if (ret) { | 1444 | if (ret) { |
@@ -1485,48 +1480,6 @@ static int usbduxfast_attach_common(struct comedi_device *dev, | |||
1485 | return 0; | 1480 | return 0; |
1486 | } | 1481 | } |
1487 | 1482 | ||
1488 | /* is called for COMEDI_DEVCONFIG ioctl (when comedi_config is run) */ | ||
1489 | static int usbduxfast_attach(struct comedi_device *dev, | ||
1490 | struct comedi_devconfig *it) | ||
1491 | { | ||
1492 | int ret; | ||
1493 | int index; | ||
1494 | int i; | ||
1495 | void *aux_data; | ||
1496 | int aux_len; | ||
1497 | |||
1498 | dev->private = NULL; | ||
1499 | |||
1500 | aux_data = comedi_aux_data(it->options, 0); | ||
1501 | aux_len = it->options[COMEDI_DEVCONF_AUX_DATA_LENGTH]; | ||
1502 | if (aux_data == NULL) | ||
1503 | aux_len = 0; | ||
1504 | else if (aux_len == 0) | ||
1505 | aux_data = NULL; | ||
1506 | down(&start_stop_sem); | ||
1507 | /* | ||
1508 | * find a valid device which has been detected by the | ||
1509 | * probe function of the usb | ||
1510 | */ | ||
1511 | index = -1; | ||
1512 | for (i = 0; i < NUMUSBDUXFAST; i++) { | ||
1513 | if (usbduxfastsub[i].probed && !usbduxfastsub[i].attached) { | ||
1514 | index = i; | ||
1515 | break; | ||
1516 | } | ||
1517 | } | ||
1518 | if (index < 0) { | ||
1519 | dev_err(dev->class_dev, | ||
1520 | "usbduxfast: error: attach failed, no usbduxfast devs connected to the usb bus.\n"); | ||
1521 | ret = -ENODEV; | ||
1522 | } else | ||
1523 | ret = usbduxfast_attach_common(dev, &usbduxfastsub[index], | ||
1524 | aux_data, aux_len); | ||
1525 | up(&start_stop_sem); | ||
1526 | return ret; | ||
1527 | } | ||
1528 | |||
1529 | /* is called from comedi_usb_auto_config() */ | ||
1530 | static int usbduxfast_attach_usb(struct comedi_device *dev, | 1483 | static int usbduxfast_attach_usb(struct comedi_device *dev, |
1531 | struct usb_interface *uinterf) | 1484 | struct usb_interface *uinterf) |
1532 | { | 1485 | { |
@@ -1545,7 +1498,7 @@ static int usbduxfast_attach_usb(struct comedi_device *dev, | |||
1545 | "usbduxfast: error: attach_usb failed, already attached\n"); | 1498 | "usbduxfast: error: attach_usb failed, already attached\n"); |
1546 | ret = -ENODEV; | 1499 | ret = -ENODEV; |
1547 | } else | 1500 | } else |
1548 | ret = usbduxfast_attach_common(dev, udfs, NULL, 0); | 1501 | ret = usbduxfast_attach_common(dev, udfs); |
1549 | up(&start_stop_sem); | 1502 | up(&start_stop_sem); |
1550 | return ret; | 1503 | return ret; |
1551 | } | 1504 | } |
@@ -1568,9 +1521,8 @@ static void usbduxfast_detach(struct comedi_device *dev) | |||
1568 | static struct comedi_driver usbduxfast_driver = { | 1521 | static struct comedi_driver usbduxfast_driver = { |
1569 | .driver_name = "usbduxfast", | 1522 | .driver_name = "usbduxfast", |
1570 | .module = THIS_MODULE, | 1523 | .module = THIS_MODULE, |
1571 | .attach = usbduxfast_attach, | ||
1572 | .detach = usbduxfast_detach, | ||
1573 | .attach_usb = usbduxfast_attach_usb, | 1524 | .attach_usb = usbduxfast_attach_usb, |
1525 | .detach = usbduxfast_detach, | ||
1574 | }; | 1526 | }; |
1575 | 1527 | ||
1576 | static void usbduxfast_firmware_request_complete_handler(const struct firmware | 1528 | static void usbduxfast_firmware_request_complete_handler(const struct firmware |