Commit fb62a3f1 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0b237289
...@@ -50,7 +50,7 @@ Status: testing ...@@ -50,7 +50,7 @@ Status: testing
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/fcntl.h> #include <linux/fcntl.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/firmware.h>
#include "comedi_fc.h" #include "comedi_fc.h"
#include "../comedidev.h" #include "../comedidev.h"
...@@ -670,9 +670,11 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb) ...@@ -670,9 +670,11 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb)
/* the FX2LP has twice as much as the standard FX2 */ /* the FX2LP has twice as much as the standard FX2 */
#define FIRMWARE_MAX_LEN 0x4000 #define FIRMWARE_MAX_LEN 0x4000
static int firmwareUpload(struct usbduxsub *usbduxsub, static int usbduxsigma_firmware_upload(struct comedi_device *dev,
const u8 *data, int size) const u8 *data, size_t size,
unsigned long context)
{ {
struct usbduxsub *usbduxsub = dev->private;
struct usb_device *usb = usbduxsub->usbdev; struct usb_device *usb = usbduxsub->usbdev;
uint8_t *buf; uint8_t *buf;
uint8_t *tmp; uint8_t *tmp;
...@@ -2236,16 +2238,15 @@ static int usbduxsigma_auto_attach(struct comedi_device *dev, ...@@ -2236,16 +2238,15 @@ static int usbduxsigma_auto_attach(struct comedi_device *dev,
struct usb_interface *uinterf = comedi_to_usb_interface(dev); struct usb_interface *uinterf = comedi_to_usb_interface(dev);
struct usbduxsub *uds = usb_get_intfdata(uinterf); struct usbduxsub *uds = usb_get_intfdata(uinterf);
struct usb_device *usb = uds->usbdev; struct usb_device *usb = uds->usbdev;
const struct firmware *fw;
int ret; int ret;
ret = request_firmware(&fw, FIRMWARE, &usb->dev); dev->private = uds; /* This is temporary... */
if (ret == 0) { ret = comedi_load_firmware(dev, &usb->dev, FIRMWARE,
ret = firmwareUpload(uds, fw->data, fw->size); usbduxsigma_firmware_upload, 0);
release_firmware(fw); if (ret < 0) {
} dev->private = NULL;
if (ret < 0)
return ret; return ret;
}
dev->private = NULL; dev->private = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment