summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2013-05-20 14:32:29 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-05-21 10:59:24 -0700
commitfb62a3f133e305b8b3b74b48c5a79330574cc892 (patch)
tree2762bff686e99ad115679779767585e580e4c3b9 /drivers
parent0b2372897b0c23ee3f34656f3daf04e59c7f186b (diff)
staging: comedi: usbduxsigma: use comedi_load_firmware()
Use comedi_load_firmware() instead of duplicating the code in a private function. Also, rename firmwareUpload() to have namespace associated with the driver. 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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/comedi/drivers/usbduxsigma.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c
index 26357b9cbcd5..5663197702a2 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -50,7 +50,7 @@ Status: testing
#include <linux/usb.h>
#include <linux/fcntl.h>
#include <linux/compiler.h>
-#include <linux/firmware.h>
+
#include "comedi_fc.h"
#include "../comedidev.h"
@@ -670,9 +670,11 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb)
/* the FX2LP has twice as much as the standard FX2 */
#define FIRMWARE_MAX_LEN 0x4000
-static int firmwareUpload(struct usbduxsub *usbduxsub,
- const u8 *data, int size)
+static int usbduxsigma_firmware_upload(struct comedi_device *dev,
+ const u8 *data, size_t size,
+ unsigned long context)
{
+ struct usbduxsub *usbduxsub = dev->private;
struct usb_device *usb = usbduxsub->usbdev;
uint8_t *buf;
uint8_t *tmp;
@@ -2236,16 +2238,15 @@ static int usbduxsigma_auto_attach(struct comedi_device *dev,
struct usb_interface *uinterf = comedi_to_usb_interface(dev);
struct usbduxsub *uds = usb_get_intfdata(uinterf);
struct usb_device *usb = uds->usbdev;
- const struct firmware *fw;
int ret;
- ret = request_firmware(&fw, FIRMWARE, &usb->dev);
- if (ret == 0) {
- ret = firmwareUpload(uds, fw->data, fw->size);
- release_firmware(fw);
- }
- if (ret < 0)
+ dev->private = uds; /* This is temporary... */
+ ret = comedi_load_firmware(dev, &usb->dev, FIRMWARE,
+ usbduxsigma_firmware_upload, 0);
+ if (ret < 0) {
+ dev->private = NULL;
return ret;
+ }
dev->private = NULL;