Skip to content

Commit

Permalink
staging: comedi: usbduxsigma: use comedi_load_firmware()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc Ian Abbott <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
bigguiness authored and gregkh committed May 21, 2013
1 parent 0b23728 commit fb62a3f
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions drivers/staging/comedi/drivers/usbduxsigma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit fb62a3f

Please sign in to comment.