staging: comedi: usbduxfast: request firmware synchronously
Change the request_firmware_nowait() to a request_firmware() so that the usb_driver (*probe) and 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>
This commit is contained in:
parent
4e595c0d23
commit
998bb7be46
1 changed files with 17 additions and 30 deletions
|
@ -1470,31 +1470,21 @@ static struct comedi_driver usbduxfast_driver = {
|
||||||
.detach = usbduxfast_detach,
|
.detach = usbduxfast_detach,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void usbduxfast_firmware_request_complete_handler(const struct firmware
|
static int usbduxfast_request_firmware(struct usb_interface *intf)
|
||||||
*fw, void *context)
|
|
||||||
{
|
{
|
||||||
struct usbduxfastsub_s *usbduxfastsub_tmp = context;
|
struct usb_device *usb = interface_to_usbdev(intf);
|
||||||
struct usb_interface *uinterf = usbduxfastsub_tmp->interface;
|
struct usbduxfastsub_s *devpriv = usb_get_intfdata(intf);
|
||||||
|
const struct firmware *fw;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (fw == NULL)
|
ret = request_firmware(&fw, FIRMWARE, &usb->dev);
|
||||||
return;
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
/*
|
ret = firmwareUpload(devpriv, fw->data, fw->size);
|
||||||
* we need to upload the firmware here because fw will be
|
|
||||||
* freed once we've left this function
|
|
||||||
*/
|
|
||||||
ret = firmwareUpload(usbduxfastsub_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, &usbduxfast_driver, 0);
|
|
||||||
out:
|
|
||||||
release_firmware(fw);
|
release_firmware(fw);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int usbduxfast_usb_probe(struct usb_interface *uinterf,
|
static int usbduxfast_usb_probe(struct usb_interface *uinterf,
|
||||||
|
@ -1598,14 +1588,11 @@ static int usbduxfast_usb_probe(struct usb_interface *uinterf,
|
||||||
usbduxfastsub[index].probed = 1;
|
usbduxfastsub[index].probed = 1;
|
||||||
up(&start_stop_sem);
|
up(&start_stop_sem);
|
||||||
|
|
||||||
ret = request_firmware_nowait(THIS_MODULE,
|
/*
|
||||||
FW_ACTION_HOTPLUG,
|
* Request, and upload, the firmware so we can
|
||||||
FIRMWARE,
|
* complete the comedi_driver (*auto_attach).
|
||||||
&udev->dev,
|
*/
|
||||||
GFP_KERNEL,
|
ret = usbduxfast_request_firmware(uinterf);
|
||||||
usbduxfastsub + index,
|
|
||||||
usbduxfast_firmware_request_complete_handler);
|
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&uinterf->dev, "could not load firmware (err=%d)\n", ret);
|
dev_err(&uinterf->dev, "could not load firmware (err=%d)\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1613,8 +1600,8 @@ static int usbduxfast_usb_probe(struct usb_interface *uinterf,
|
||||||
|
|
||||||
dev_info(&uinterf->dev,
|
dev_info(&uinterf->dev,
|
||||||
"usbduxfast%d has been successfully initialized.\n", index);
|
"usbduxfast%d has been successfully initialized.\n", index);
|
||||||
/* success */
|
|
||||||
return 0;
|
return comedi_usb_auto_config(uinterf, &usbduxfast_driver, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usbduxfast_usb_disconnect(struct usb_interface *intf)
|
static void usbduxfast_usb_disconnect(struct usb_interface *intf)
|
||||||
|
|
Loading…
Add table
Reference in a new issue