From: H Hartley Sweeten Date: Tue, 14 May 2013 20:40:02 +0000 (-0700) Subject: staging: comedi: usbduxfast: move usbduxfast_upload_firmware() X-Git-Tag: firefly_0821_release~176^2~5845^2~641 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=dcd29f56e58ecffe68f381910a4cecbeba37594c;p=firefly-linux-kernel-4.4.55.git staging: comedi: usbduxfast: move usbduxfast_upload_firmware() For aesthetic reasons, move usbduxfast_upload_firmware() near its only caller, usbduxfast_request_firmware(). Also, move the #define for the maximum firmware size so it's with the other firmware defines. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index 6e13f203ae66..1c07ab3e1569 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -56,6 +56,7 @@ * constants for "firmware" upload and download */ #define FIRMWARE "usbduxfast_firmware.bin" +#define FIRMWARE_MAX_LEN 0x2000 #define USBDUXFASTSUB_FIRMWARE 0xA0 #define VENDOR_DIR_IN 0xC0 #define VENDOR_DIR_OUT 0x40 @@ -1121,7 +1122,38 @@ static int usbduxfast_ai_insn_read(struct comedi_device *dev, return i; } -#define FIRMWARE_MAX_LEN 0x2000 +static int usbduxfast_attach_common(struct comedi_device *dev) +{ + struct usbduxfast_private *devpriv = dev->private; + struct comedi_subdevice *s; + int ret; + + down(&devpriv->sem); + + ret = comedi_alloc_subdevices(dev, 1); + if (ret) { + up(&devpriv->sem); + return ret; + } + + /* Analog Input subdevice */ + s = &dev->subdevices[0]; + dev->read_subdev = s; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_CMD_READ; + s->n_chan = 16; + s->len_chanlist = 16; + s->insn_read = usbduxfast_ai_insn_read; + s->do_cmdtest = usbduxfast_ai_cmdtest; + s->do_cmd = usbduxfast_ai_cmd; + s->cancel = usbduxfast_ai_cancel; + s->maxdata = 0x1000; + s->range_table = &range_usbduxfast_ai_range; + + up(&devpriv->sem); + + return 0; +} static int usbduxfast_upload_firmware(struct comedi_device *dev, const struct firmware *fw) @@ -1162,39 +1194,6 @@ done: return ret; } -static int usbduxfast_attach_common(struct comedi_device *dev) -{ - struct usbduxfast_private *devpriv = dev->private; - struct comedi_subdevice *s; - int ret; - - down(&devpriv->sem); - - ret = comedi_alloc_subdevices(dev, 1); - if (ret) { - up(&devpriv->sem); - return ret; - } - - /* Analog Input subdevice */ - s = &dev->subdevices[0]; - dev->read_subdev = s; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_CMD_READ; - s->n_chan = 16; - s->len_chanlist = 16; - s->insn_read = usbduxfast_ai_insn_read; - s->do_cmdtest = usbduxfast_ai_cmdtest; - s->do_cmd = usbduxfast_ai_cmd; - s->cancel = usbduxfast_ai_cancel; - s->maxdata = 0x1000; - s->range_table = &range_usbduxfast_ai_range; - - up(&devpriv->sem); - - return 0; -} - static int usbduxfast_request_firmware(struct comedi_device *dev) { struct usb_interface *intf = comedi_to_usb_interface(dev);