提交 41327b3e 编写于 作者: H H Hartley Sweeten 提交者: Greg Kroah-Hartman

staging: comedi: usbduxsigma: request firmware synchronously

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: NH Hartley Sweeten <hsweeten@visionengravers.com>
Cc Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 1383b9dd
...@@ -2346,40 +2346,12 @@ static struct comedi_driver usbduxsigma_driver = { ...@@ -2346,40 +2346,12 @@ static struct comedi_driver usbduxsigma_driver = {
.detach = usbduxsigma_detach, .detach = usbduxsigma_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 = firmwareUpload(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, &usbduxsigma_driver, 0);
out:
release_firmware(fw);
}
static int usbduxsigma_usb_probe(struct usb_interface *uinterf, static int usbduxsigma_usb_probe(struct usb_interface *uinterf,
const struct usb_device_id *id) const struct usb_device_id *id)
{ {
struct usb_device *udev = interface_to_usbdev(uinterf); struct usb_device *udev = interface_to_usbdev(uinterf);
struct device *dev = &uinterf->dev; struct device *dev = &uinterf->dev;
const struct firmware *fw;
int i; int i;
int index; int index;
int ret; int ret;
...@@ -2600,23 +2572,17 @@ static int usbduxsigma_usb_probe(struct usb_interface *uinterf, ...@@ -2600,23 +2572,17 @@ static int usbduxsigma_usb_probe(struct usb_interface *uinterf,
usbduxsub[index].probed = 1; usbduxsub[index].probed = 1;
up(&start_stop_sem); up(&start_stop_sem);
ret = request_firmware_nowait(THIS_MODULE, ret = request_firmware(&fw, FIRMWARE, &udev->dev);
FW_ACTION_HOTPLUG, if (ret == 0) {
FIRMWARE, ret = firmwareUpload(&usbduxsub[index], fw->data, fw->size);
&udev->dev, release_firmware(fw);
GFP_KERNEL, }
usbduxsub + index,
usbdux_firmware_request_complete_handler
);
if (ret) { if (ret) {
dev_err(dev, "Could not load firmware (err=%d)\n", ret); dev_err(dev, "Could not load firmware (err=%d)\n", ret);
return ret; return ret;
} }
dev_info(dev, "comedi_: successfully initialised.\n"); return comedi_usb_auto_config(uinterf, &usbduxsigma_driver, 0);;
/* success */
return 0;
} }
static void usbduxsigma_usb_disconnect(struct usb_interface *intf) static void usbduxsigma_usb_disconnect(struct usb_interface *intf)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册