]> Pileus Git - ~andy/linux/commitdiff
staging: comedi: usbdux: request firmware synchronously
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 20 May 2013 21:29:06 +0000 (14:29 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 May 2013 17:59:11 +0000 (10:59 -0700)
Change the request_firmware_nowait() to a request_firmware() so
that the usb_driver (*probe) can continue with the comedi_driver
(*auto_attach).

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>
drivers/staging/comedi/drivers/usbdux.c

index fec0881aff16ceaa80f3330633f8c86fc17fd596..cb63c77cc131db5fceb11988fd5f770c4fee4665 100644 (file)
@@ -2364,40 +2364,12 @@ static struct comedi_driver usbdux_driver = {
        .detach         = usbdux_detach,
 };
 
-static void usbdux_firmware_request_complete_handler(const struct firmware *fw,
-                                                    void *context)
-{
-       struct usbduxsub *usbduxsub_tmp = context;
-       struct usb_interface *uinterf = usbduxsub_tmp->interface;
-       int ret;
-
-       if (fw == NULL) {
-               dev_err(&uinterf->dev,
-                       "Firmware complete handler without firmware!\n");
-               return;
-       }
-
-       /*
-        * we need to upload the firmware here because fw will be
-        * freed once we've left this function
-        */
-       ret = firmware_upload(usbduxsub_tmp, fw->data, fw->size);
-
-       if (ret) {
-               dev_err(&uinterf->dev,
-                       "Could not upload firmware (err=%d)\n", ret);
-               goto out;
-       }
-       comedi_usb_auto_config(uinterf, &usbdux_driver, 0);
- out:
-       release_firmware(fw);
-}
-
 static int usbdux_usb_probe(struct usb_interface *uinterf,
                            const struct usb_device_id *id)
 {
        struct usb_device *udev = interface_to_usbdev(uinterf);
        struct device *dev = &uinterf->dev;
+       const struct firmware *fw;
        int i;
        int index;
        int ret;
@@ -2617,23 +2589,15 @@ static int usbdux_usb_probe(struct usb_interface *uinterf,
        usbduxsub[index].probed = 1;
        up(&start_stop_sem);
 
-       ret = request_firmware_nowait(THIS_MODULE,
-                                     FW_ACTION_HOTPLUG,
-                                     FIRMWARE,
-                                     &udev->dev,
-                                     GFP_KERNEL,
-                                     usbduxsub + index,
-                                     usbdux_firmware_request_complete_handler);
-
-       if (ret) {
-               dev_err(dev, "Could not load firmware (err=%d)\n", ret);
-               return ret;
+       ret = request_firmware(&fw, FIRMWARE, &udev->dev);
+       if (ret == 0) {
+               ret = firmware_upload(&usbduxsub[index], fw->data, fw->size);
+               release_firmware(fw);
        }
+       if (ret < 0)
+               return ret;
 
-       dev_info(dev, "comedi_: usbdux%d "
-                "has been successfully initialised.\n", index);
-       /* success */
-       return 0;
+       return comedi_usb_auto_config(uinterf, &usbdux_driver, 0);
 }
 
 static void usbdux_usb_disconnect(struct usb_interface *intf)