diff options
author | H Hartley Sweeten <hartleys@visionengravers.com> | 2012-09-19 19:21:13 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-21 12:24:16 -0400 |
commit | 5a0f2260897621cc0118cd16801b171acd06c31c (patch) | |
tree | 20b9a0973d71aa849959331e20c9bc7e36691ffa | |
parent | 4e5ba2f6bd1c480ce6b362a17a6a3456a2354cf0 (diff) |
staging: comedi: usbdux: remove usbdux_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/usbdux.c | 55 |
1 files changed, 3 insertions, 52 deletions
diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 7aac213fb6ab..bc5fc5cc4641 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c | |||
@@ -2293,10 +2293,8 @@ static void tidy_up(struct usbduxsub *usbduxsub_tmp) | |||
2293 | usbduxsub_tmp->pwm_cmd_running = 0; | 2293 | usbduxsub_tmp->pwm_cmd_running = 0; |
2294 | } | 2294 | } |
2295 | 2295 | ||
2296 | /* common part of attach and attach_usb */ | ||
2297 | static int usbdux_attach_common(struct comedi_device *dev, | 2296 | static int usbdux_attach_common(struct comedi_device *dev, |
2298 | struct usbduxsub *udev, | 2297 | struct usbduxsub *udev) |
2299 | void *aux_data, int aux_len) | ||
2300 | { | 2298 | { |
2301 | int ret; | 2299 | int ret; |
2302 | struct comedi_subdevice *s = NULL; | 2300 | struct comedi_subdevice *s = NULL; |
@@ -2306,10 +2304,6 @@ static int usbdux_attach_common(struct comedi_device *dev, | |||
2306 | /* pointer back to the corresponding comedi device */ | 2304 | /* pointer back to the corresponding comedi device */ |
2307 | udev->comedidev = dev; | 2305 | udev->comedidev = dev; |
2308 | 2306 | ||
2309 | /* trying to upload the firmware into the chip */ | ||
2310 | if (aux_data) | ||
2311 | firmwareUpload(udev, aux_data, aux_len); | ||
2312 | |||
2313 | dev->board_name = "usbdux"; | 2307 | dev->board_name = "usbdux"; |
2314 | 2308 | ||
2315 | /* set number of subdevices */ | 2309 | /* set number of subdevices */ |
@@ -2429,48 +2423,6 @@ static int usbdux_attach_common(struct comedi_device *dev, | |||
2429 | return 0; | 2423 | return 0; |
2430 | } | 2424 | } |
2431 | 2425 | ||
2432 | /* is called when comedi-config is called */ | ||
2433 | static int usbdux_attach(struct comedi_device *dev, struct comedi_devconfig *it) | ||
2434 | { | ||
2435 | int ret; | ||
2436 | int index; | ||
2437 | int i; | ||
2438 | void *aux_data; | ||
2439 | int aux_len; | ||
2440 | |||
2441 | dev->private = NULL; | ||
2442 | |||
2443 | aux_data = comedi_aux_data(it->options, 0); | ||
2444 | aux_len = it->options[COMEDI_DEVCONF_AUX_DATA_LENGTH]; | ||
2445 | if (aux_data == NULL) | ||
2446 | aux_len = 0; | ||
2447 | else if (aux_len == 0) | ||
2448 | aux_data = NULL; | ||
2449 | |||
2450 | down(&start_stop_sem); | ||
2451 | /* find a valid device which has been detected by the probe function of | ||
2452 | * the usb */ | ||
2453 | index = -1; | ||
2454 | for (i = 0; i < NUMUSBDUX; i++) { | ||
2455 | if ((usbduxsub[i].probed) && (!usbduxsub[i].attached)) { | ||
2456 | index = i; | ||
2457 | break; | ||
2458 | } | ||
2459 | } | ||
2460 | |||
2461 | if (index < 0) { | ||
2462 | printk(KERN_ERR | ||
2463 | "comedi%d: usbdux: error: attach failed, no usbdux devs connected to the usb bus.\n", | ||
2464 | dev->minor); | ||
2465 | ret = -ENODEV; | ||
2466 | } else | ||
2467 | ret = usbdux_attach_common(dev, &usbduxsub[index], | ||
2468 | aux_data, aux_len); | ||
2469 | up(&start_stop_sem); | ||
2470 | return ret; | ||
2471 | } | ||
2472 | |||
2473 | /* is called from comedi_usb_auto_config() */ | ||
2474 | static int usbdux_attach_usb(struct comedi_device *dev, | 2426 | static int usbdux_attach_usb(struct comedi_device *dev, |
2475 | struct usb_interface *uinterf) | 2427 | struct usb_interface *uinterf) |
2476 | { | 2428 | { |
@@ -2492,7 +2444,7 @@ static int usbdux_attach_usb(struct comedi_device *dev, | |||
2492 | dev->minor); | 2444 | dev->minor); |
2493 | ret = -ENODEV; | 2445 | ret = -ENODEV; |
2494 | } else | 2446 | } else |
2495 | ret = usbdux_attach_common(dev, this_usbduxsub, NULL, 0); | 2447 | ret = usbdux_attach_common(dev, this_usbduxsub); |
2496 | up(&start_stop_sem); | 2448 | up(&start_stop_sem); |
2497 | return ret; | 2449 | return ret; |
2498 | } | 2450 | } |
@@ -2513,9 +2465,8 @@ static void usbdux_detach(struct comedi_device *dev) | |||
2513 | static struct comedi_driver usbdux_driver = { | 2465 | static struct comedi_driver usbdux_driver = { |
2514 | .driver_name = "usbdux", | 2466 | .driver_name = "usbdux", |
2515 | .module = THIS_MODULE, | 2467 | .module = THIS_MODULE, |
2516 | .attach = usbdux_attach, | ||
2517 | .detach = usbdux_detach, | ||
2518 | .attach_usb = usbdux_attach_usb, | 2468 | .attach_usb = usbdux_attach_usb, |
2469 | .detach = usbdux_detach, | ||
2519 | }; | 2470 | }; |
2520 | 2471 | ||
2521 | static void usbdux_firmware_request_complete_handler(const struct firmware *fw, | 2472 | static void usbdux_firmware_request_complete_handler(const struct firmware *fw, |