Commit b74e5f56 authored by Jacob Garber's avatar Jacob Garber Committed by Greg Kroah-Hartman

Staging: comedi: Fixed camel case style issue in usbdux.c

This is a patch to usbdux.c that fixes the camel case warnings found
by the checkpatch.pl tool
Signed-off-by: default avatarJacob Garber <ajtgarber@gmail.com>
Reviewed-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 51cfbbb9
...@@ -250,26 +250,26 @@ struct usbduxsub { ...@@ -250,26 +250,26 @@ struct usbduxsub {
/* pointer to the usb-device */ /* pointer to the usb-device */
struct usb_device *usbdev; struct usb_device *usbdev;
/* actual number of in-buffers */ /* actual number of in-buffers */
int numOfInBuffers; int num_in_buffers;
/* actual number of out-buffers */ /* actual number of out-buffers */
int numOfOutBuffers; int num_out_buffers;
/* ISO-transfer handling: buffers */ /* ISO-transfer handling: buffers */
struct urb **urbIn; struct urb **urb_in;
struct urb **urbOut; struct urb **urb_out;
/* pwm-transfer handling */ /* pwm-transfer handling */
struct urb *urbPwm; struct urb *urb_pwm;
/* PWM period */ /* PWM period */
unsigned int pwmPeriod; unsigned int pwm_period;
/* PWM internal delay for the GPIF in the FX2 */ /* PWM internal delay for the GPIF in the FX2 */
int8_t pwmDelay; int8_t pwn_delay;
/* size of the PWM buffer which holds the bit pattern */ /* size of the PWM buffer which holds the bit pattern */
int sizePwmBuf; int size_pwm_buf;
/* input buffer for the ISO-transfer */ /* input buffer for the ISO-transfer */
int16_t *inBuffer; int16_t *in_buffer;
/* input buffer for single insn */ /* input buffer for single insn */
int16_t *insnBuffer; int16_t *insn_buffer;
/* output buffer for single DA outputs */ /* output buffer for single DA outputs */
int16_t *outBuffer; int16_t *out_buffer;
/* interface number */ /* interface number */
int ifnum; int ifnum;
/* interface structure in 2.6 */ /* interface structure in 2.6 */
...@@ -319,17 +319,17 @@ static DEFINE_SEMAPHORE(start_stop_sem); ...@@ -319,17 +319,17 @@ static DEFINE_SEMAPHORE(start_stop_sem);
* Stops the data acquision * Stops the data acquision
* It should be safe to call this function from any context * It should be safe to call this function from any context
*/ */
static int usbduxsub_unlink_InURBs(struct usbduxsub *usbduxsub_tmp) static int usbduxsub_unlink_inurbs(struct usbduxsub *usbduxsub_tmp)
{ {
int i = 0; int i = 0;
int err = 0; int err = 0;
if (usbduxsub_tmp && usbduxsub_tmp->urbIn) { if (usbduxsub_tmp && usbduxsub_tmp->urb_in) {
for (i = 0; i < usbduxsub_tmp->numOfInBuffers; i++) { for (i = 0; i < usbduxsub_tmp->num_in_buffers; i++) {
if (usbduxsub_tmp->urbIn[i]) { if (usbduxsub_tmp->urb_in[i]) {
/* We wait here until all transfers have been /* We wait here until all transfers have been
* cancelled. */ * cancelled. */
usb_kill_urb(usbduxsub_tmp->urbIn[i]); usb_kill_urb(usbduxsub_tmp->urb_in[i]);
} }
dev_dbg(&usbduxsub_tmp->interface->dev, dev_dbg(&usbduxsub_tmp->interface->dev,
"comedi: usbdux: unlinked InURB %d, err=%d\n", "comedi: usbdux: unlinked InURB %d, err=%d\n",
...@@ -356,7 +356,7 @@ static int usbdux_ai_stop(struct usbduxsub *this_usbduxsub, int do_unlink) ...@@ -356,7 +356,7 @@ static int usbdux_ai_stop(struct usbduxsub *this_usbduxsub, int do_unlink)
if (do_unlink) { if (do_unlink) {
/* stop aquistion */ /* stop aquistion */
ret = usbduxsub_unlink_InURBs(this_usbduxsub); ret = usbduxsub_unlink_inurbs(this_usbduxsub);
} }
this_usbduxsub->ai_cmd_running = 0; this_usbduxsub->ai_cmd_running = 0;
...@@ -394,7 +394,7 @@ static int usbdux_ai_cancel(struct comedi_device *dev, ...@@ -394,7 +394,7 @@ static int usbdux_ai_cancel(struct comedi_device *dev,
} }
/* analogue IN - interrupt service routine */ /* analogue IN - interrupt service routine */
static void usbduxsub_ai_IsocIrq(struct urb *urb) static void usbduxsub_ai_isoc_irq(struct urb *urb)
{ {
int i, err, n; int i, err, n;
struct usbduxsub *this_usbduxsub; struct usbduxsub *this_usbduxsub;
...@@ -412,7 +412,7 @@ static void usbduxsub_ai_IsocIrq(struct urb *urb) ...@@ -412,7 +412,7 @@ static void usbduxsub_ai_IsocIrq(struct urb *urb)
switch (urb->status) { switch (urb->status) {
case 0: case 0:
/* copy the result in the transfer buffer */ /* copy the result in the transfer buffer */
memcpy(this_usbduxsub->inBuffer, memcpy(this_usbduxsub->in_buffer,
urb->transfer_buffer, SIZEINBUF); urb->transfer_buffer, SIZEINBUF);
break; break;
case -EILSEQ: case -EILSEQ:
...@@ -517,11 +517,11 @@ static void usbduxsub_ai_IsocIrq(struct urb *urb) ...@@ -517,11 +517,11 @@ static void usbduxsub_ai_IsocIrq(struct urb *urb)
if (CR_RANGE(s->async->cmd.chanlist[i]) <= 1) { if (CR_RANGE(s->async->cmd.chanlist[i]) <= 1) {
err = comedi_buf_put err = comedi_buf_put
(s->async, (s->async,
le16_to_cpu(this_usbduxsub->inBuffer[i]) ^ 0x800); le16_to_cpu(this_usbduxsub->in_buffer[i]) ^ 0x800);
} else { } else {
err = comedi_buf_put err = comedi_buf_put
(s->async, (s->async,
le16_to_cpu(this_usbduxsub->inBuffer[i])); le16_to_cpu(this_usbduxsub->in_buffer[i]));
} }
if (unlikely(err == 0)) { if (unlikely(err == 0)) {
/* buffer overflow */ /* buffer overflow */
...@@ -534,15 +534,15 @@ static void usbduxsub_ai_IsocIrq(struct urb *urb) ...@@ -534,15 +534,15 @@ static void usbduxsub_ai_IsocIrq(struct urb *urb)
comedi_event(this_usbduxsub->comedidev, s); comedi_event(this_usbduxsub->comedidev, s);
} }
static int usbduxsub_unlink_OutURBs(struct usbduxsub *usbduxsub_tmp) static int usbduxsub_unlink_outurbs(struct usbduxsub *usbduxsub_tmp)
{ {
int i = 0; int i = 0;
int err = 0; int err = 0;
if (usbduxsub_tmp && usbduxsub_tmp->urbOut) { if (usbduxsub_tmp && usbduxsub_tmp->urb_out) {
for (i = 0; i < usbduxsub_tmp->numOfOutBuffers; i++) { for (i = 0; i < usbduxsub_tmp->num_out_buffers; i++) {
if (usbduxsub_tmp->urbOut[i]) if (usbduxsub_tmp->urb_out[i])
usb_kill_urb(usbduxsub_tmp->urbOut[i]); usb_kill_urb(usbduxsub_tmp->urb_out[i]);
dev_dbg(&usbduxsub_tmp->interface->dev, dev_dbg(&usbduxsub_tmp->interface->dev,
"comedi: usbdux: unlinked OutURB %d: res=%d\n", "comedi: usbdux: unlinked OutURB %d: res=%d\n",
...@@ -564,7 +564,7 @@ static int usbdux_ao_stop(struct usbduxsub *this_usbduxsub, int do_unlink) ...@@ -564,7 +564,7 @@ static int usbdux_ao_stop(struct usbduxsub *this_usbduxsub, int do_unlink)
dev_dbg(&this_usbduxsub->interface->dev, "comedi: usbdux_ao_cancel\n"); dev_dbg(&this_usbduxsub->interface->dev, "comedi: usbdux_ao_cancel\n");
if (do_unlink) if (do_unlink)
ret = usbduxsub_unlink_OutURBs(this_usbduxsub); ret = usbduxsub_unlink_outurbs(this_usbduxsub);
this_usbduxsub->ao_cmd_running = 0; this_usbduxsub->ao_cmd_running = 0;
...@@ -593,7 +593,7 @@ static int usbdux_ao_cancel(struct comedi_device *dev, ...@@ -593,7 +593,7 @@ static int usbdux_ao_cancel(struct comedi_device *dev,
return res; return res;
} }
static void usbduxsub_ao_IsocIrq(struct urb *urb) static void usbduxsub_ao_isoc_irq(struct urb *urb)
{ {
int i, ret; int i, ret;
int8_t *datap; int8_t *datap;
...@@ -791,7 +791,7 @@ static int usbduxsub_stop(struct usbduxsub *usbduxsub) ...@@ -791,7 +791,7 @@ static int usbduxsub_stop(struct usbduxsub *usbduxsub)
static int usbduxsub_upload(struct usbduxsub *usbduxsub, static int usbduxsub_upload(struct usbduxsub *usbduxsub,
uint8_t *local_transfer_buffer, uint8_t *local_transfer_buffer,
unsigned int startAddr, unsigned int len) unsigned int start_addr, unsigned int len)
{ {
int errcode; int errcode;
...@@ -802,7 +802,7 @@ static int usbduxsub_upload(struct usbduxsub *usbduxsub, ...@@ -802,7 +802,7 @@ static int usbduxsub_upload(struct usbduxsub *usbduxsub,
/* bmRequestType */ /* bmRequestType */
VENDOR_DIR_OUT, VENDOR_DIR_OUT,
/* value */ /* value */
startAddr, start_addr,
/* index */ /* index */
0x0000, 0x0000,
/* our local safe buffer */ /* our local safe buffer */
...@@ -821,24 +821,24 @@ static int usbduxsub_upload(struct usbduxsub *usbduxsub, ...@@ -821,24 +821,24 @@ static int usbduxsub_upload(struct usbduxsub *usbduxsub,
#define FIRMWARE_MAX_LEN 0x2000 #define FIRMWARE_MAX_LEN 0x2000
static int firmwareUpload(struct usbduxsub *usbduxsub, static int firmware_upload(struct usbduxsub *usbduxsub,
const u8 *firmwareBinary, int sizeFirmware) const u8 *firmware_binary, int size_firmware)
{ {
int ret; int ret;
uint8_t *fwBuf; uint8_t *fw_buf;
if (!firmwareBinary) if (!firmware_binary)
return 0; return 0;
if (sizeFirmware > FIRMWARE_MAX_LEN) { if (size_firmware > FIRMWARE_MAX_LEN) {
dev_err(&usbduxsub->interface->dev, dev_err(&usbduxsub->interface->dev,
"usbdux firmware binary it too large for FX2.\n"); "usbdux firmware binary it too large for FX2.\n");
return -ENOMEM; return -ENOMEM;
} }
/* we generate a local buffer for the firmware */ /* we generate a local buffer for the firmware */
fwBuf = kmemdup(firmwareBinary, sizeFirmware, GFP_KERNEL); fw_buf = kmemdup(firmware_binary, size_firmware, GFP_KERNEL);
if (!fwBuf) { if (!fw_buf) {
dev_err(&usbduxsub->interface->dev, dev_err(&usbduxsub->interface->dev,
"comedi_: mem alloc for firmware failed\n"); "comedi_: mem alloc for firmware failed\n");
return -ENOMEM; return -ENOMEM;
...@@ -848,81 +848,81 @@ static int firmwareUpload(struct usbduxsub *usbduxsub, ...@@ -848,81 +848,81 @@ static int firmwareUpload(struct usbduxsub *usbduxsub,
if (ret < 0) { if (ret < 0) {
dev_err(&usbduxsub->interface->dev, dev_err(&usbduxsub->interface->dev,
"comedi_: can not stop firmware\n"); "comedi_: can not stop firmware\n");
kfree(fwBuf); kfree(fw_buf);
return ret; return ret;
} }
ret = usbduxsub_upload(usbduxsub, fwBuf, 0, sizeFirmware); ret = usbduxsub_upload(usbduxsub, fw_buf, 0, size_firmware);
if (ret < 0) { if (ret < 0) {
dev_err(&usbduxsub->interface->dev, dev_err(&usbduxsub->interface->dev,
"comedi_: firmware upload failed\n"); "comedi_: firmware upload failed\n");
kfree(fwBuf); kfree(fw_buf);
return ret; return ret;
} }
ret = usbduxsub_start(usbduxsub); ret = usbduxsub_start(usbduxsub);
if (ret < 0) { if (ret < 0) {
dev_err(&usbduxsub->interface->dev, dev_err(&usbduxsub->interface->dev,
"comedi_: can not start firmware\n"); "comedi_: can not start firmware\n");
kfree(fwBuf); kfree(fw_buf);
return ret; return ret;
} }
kfree(fwBuf); kfree(fw_buf);
return 0; return 0;
} }
static int usbduxsub_submit_InURBs(struct usbduxsub *usbduxsub) static int usbduxsub_submit_inurbs(struct usbduxsub *usbduxsub)
{ {
int i, errFlag; int i, err_flag;
if (!usbduxsub) if (!usbduxsub)
return -EFAULT; return -EFAULT;
/* Submit all URBs and start the transfer on the bus */ /* Submit all URBs and start the transfer on the bus */
for (i = 0; i < usbduxsub->numOfInBuffers; i++) { for (i = 0; i < usbduxsub->num_in_buffers; i++) {
/* in case of a resubmission after an unlink... */ /* in case of a resubmission after an unlink... */
usbduxsub->urbIn[i]->interval = usbduxsub->ai_interval; usbduxsub->urb_in[i]->interval = usbduxsub->ai_interval;
usbduxsub->urbIn[i]->context = usbduxsub->comedidev; usbduxsub->urb_in[i]->context = usbduxsub->comedidev;
usbduxsub->urbIn[i]->dev = usbduxsub->usbdev; usbduxsub->urb_in[i]->dev = usbduxsub->usbdev;
usbduxsub->urbIn[i]->status = 0; usbduxsub->urb_in[i]->status = 0;
usbduxsub->urbIn[i]->transfer_flags = URB_ISO_ASAP; usbduxsub->urb_in[i]->transfer_flags = URB_ISO_ASAP;
dev_dbg(&usbduxsub->interface->dev, dev_dbg(&usbduxsub->interface->dev,
"comedi%d: submitting in-urb[%d]: %p,%p intv=%d\n", "comedi%d: submitting in-urb[%d]: %p,%p intv=%d\n",
usbduxsub->comedidev->minor, i, usbduxsub->comedidev->minor, i,
(usbduxsub->urbIn[i]->context), (usbduxsub->urb_in[i]->context),
(usbduxsub->urbIn[i]->dev), (usbduxsub->urb_in[i]->dev),
(usbduxsub->urbIn[i]->interval)); (usbduxsub->urb_in[i]->interval));
errFlag = usb_submit_urb(usbduxsub->urbIn[i], GFP_ATOMIC); err_flag = usb_submit_urb(usbduxsub->urb_in[i], GFP_ATOMIC);
if (errFlag) { if (err_flag) {
dev_err(&usbduxsub->interface->dev, dev_err(&usbduxsub->interface->dev,
"comedi_: ai: usb_submit_urb(%d) error %d\n", "comedi_: ai: usb_submit_urb(%d) error %d\n",
i, errFlag); i, err_flag);
return errFlag; return err_flag;
} }
} }
return 0; return 0;
} }
static int usbduxsub_submit_OutURBs(struct usbduxsub *usbduxsub) static int usbduxsub_submit_outurbs(struct usbduxsub *usbduxsub)
{ {
int i, errFlag; int i, err_flag;
if (!usbduxsub) if (!usbduxsub)
return -EFAULT; return -EFAULT;
for (i = 0; i < usbduxsub->numOfOutBuffers; i++) { for (i = 0; i < usbduxsub->num_out_buffers; i++) {
dev_dbg(&usbduxsub->interface->dev, dev_dbg(&usbduxsub->interface->dev,
"comedi_: submitting out-urb[%d]\n", i); "comedi_: submitting out-urb[%d]\n", i);
/* in case of a resubmission after an unlink... */ /* in case of a resubmission after an unlink... */
usbduxsub->urbOut[i]->context = usbduxsub->comedidev; usbduxsub->urb_out[i]->context = usbduxsub->comedidev;
usbduxsub->urbOut[i]->dev = usbduxsub->usbdev; usbduxsub->urb_out[i]->dev = usbduxsub->usbdev;
usbduxsub->urbOut[i]->status = 0; usbduxsub->urb_out[i]->status = 0;
usbduxsub->urbOut[i]->transfer_flags = URB_ISO_ASAP; usbduxsub->urb_out[i]->transfer_flags = URB_ISO_ASAP;
errFlag = usb_submit_urb(usbduxsub->urbOut[i], GFP_ATOMIC); err_flag = usb_submit_urb(usbduxsub->urb_out[i], GFP_ATOMIC);
if (errFlag) { if (err_flag) {
dev_err(&usbduxsub->interface->dev, dev_err(&usbduxsub->interface->dev,
"comedi_: ao: usb_submit_urb(%d) error %d\n", "comedi_: ao: usb_submit_urb(%d) error %d\n",
i, errFlag); i, err_flag);
return errFlag; return err_flag;
} }
} }
return 0; return 0;
...@@ -933,7 +933,7 @@ static int usbdux_ai_cmdtest(struct comedi_device *dev, ...@@ -933,7 +933,7 @@ static int usbdux_ai_cmdtest(struct comedi_device *dev,
{ {
struct usbduxsub *this_usbduxsub = dev->private; struct usbduxsub *this_usbduxsub = dev->private;
int err = 0, i; int err = 0, i;
unsigned int tmpTimer; unsigned int tmp_timer;
if (!(this_usbduxsub->probed)) if (!(this_usbduxsub->probed))
return -ENODEV; return -ENODEV;
...@@ -983,7 +983,7 @@ static int usbdux_ai_cmdtest(struct comedi_device *dev, ...@@ -983,7 +983,7 @@ static int usbdux_ai_cmdtest(struct comedi_device *dev,
1000000 / 8 * i); 1000000 / 8 * i);
/* now calc the real sampling rate with all the /* now calc the real sampling rate with all the
* rounding errors */ * rounding errors */
tmpTimer = tmp_timer =
((unsigned int)(cmd->scan_begin_arg / 125000)) * ((unsigned int)(cmd->scan_begin_arg / 125000)) *
125000; 125000;
} else { } else {
...@@ -994,11 +994,11 @@ static int usbdux_ai_cmdtest(struct comedi_device *dev, ...@@ -994,11 +994,11 @@ static int usbdux_ai_cmdtest(struct comedi_device *dev,
/* /*
* calc the real sampling rate with the rounding errors * calc the real sampling rate with the rounding errors
*/ */
tmpTimer = ((unsigned int)(cmd->scan_begin_arg / tmp_timer = ((unsigned int)(cmd->scan_begin_arg /
1000000)) * 1000000; 1000000)) * 1000000;
} }
err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg,
tmpTimer); tmp_timer);
} }
err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len); err |= cfc_check_trigger_arg_is(&cmd->scan_end_arg, cmd->chanlist_len);
...@@ -1074,7 +1074,7 @@ static int receive_dux_commands(struct usbduxsub *this_usbduxsub, int command) ...@@ -1074,7 +1074,7 @@ static int receive_dux_commands(struct usbduxsub *this_usbduxsub, int command)
result = usb_bulk_msg(this_usbduxsub->usbdev, result = usb_bulk_msg(this_usbduxsub->usbdev,
usb_rcvbulkpipe(this_usbduxsub->usbdev, usb_rcvbulkpipe(this_usbduxsub->usbdev,
COMMAND_IN_EP), COMMAND_IN_EP),
this_usbduxsub->insnBuffer, SIZEINSNBUF, this_usbduxsub->insn_buffer, SIZEINSNBUF,
&nrec, BULK_TIMEOUT); &nrec, BULK_TIMEOUT);
if (result < 0) { if (result < 0) {
dev_err(&this_usbduxsub->interface->dev, "comedi%d: " dev_err(&this_usbduxsub->interface->dev, "comedi%d: "
...@@ -1082,7 +1082,7 @@ static int receive_dux_commands(struct usbduxsub *this_usbduxsub, int command) ...@@ -1082,7 +1082,7 @@ static int receive_dux_commands(struct usbduxsub *this_usbduxsub, int command)
"\n", this_usbduxsub->comedidev->minor, result); "\n", this_usbduxsub->comedidev->minor, result);
return result; return result;
} }
if (le16_to_cpu(this_usbduxsub->insnBuffer[0]) == command) if (le16_to_cpu(this_usbduxsub->insn_buffer[0]) == command)
return result; return result;
} }
/* this is only reached if the data has been requested a couple of /* this is only reached if the data has been requested a couple of
...@@ -1090,7 +1090,7 @@ static int receive_dux_commands(struct usbduxsub *this_usbduxsub, int command) ...@@ -1090,7 +1090,7 @@ static int receive_dux_commands(struct usbduxsub *this_usbduxsub, int command)
dev_err(&this_usbduxsub->interface->dev, "comedi%d: insn: " dev_err(&this_usbduxsub->interface->dev, "comedi%d: insn: "
"wrong data returned from firmware: want cmd %d, got cmd %d.\n", "wrong data returned from firmware: want cmd %d, got cmd %d.\n",
this_usbduxsub->comedidev->minor, command, this_usbduxsub->comedidev->minor, command,
le16_to_cpu(this_usbduxsub->insnBuffer[0])); le16_to_cpu(this_usbduxsub->insn_buffer[0]));
return -EFAULT; return -EFAULT;
} }
...@@ -1119,7 +1119,7 @@ static int usbdux_ai_inttrig(struct comedi_device *dev, ...@@ -1119,7 +1119,7 @@ static int usbdux_ai_inttrig(struct comedi_device *dev,
} }
if (!(this_usbduxsub->ai_cmd_running)) { if (!(this_usbduxsub->ai_cmd_running)) {
this_usbduxsub->ai_cmd_running = 1; this_usbduxsub->ai_cmd_running = 1;
ret = usbduxsub_submit_InURBs(this_usbduxsub); ret = usbduxsub_submit_inurbs(this_usbduxsub);
if (ret < 0) { if (ret < 0) {
dev_err(&this_usbduxsub->interface->dev, dev_err(&this_usbduxsub->interface->dev,
"comedi%d: usbdux_ai_inttrig: " "comedi%d: usbdux_ai_inttrig: "
...@@ -1236,7 +1236,7 @@ static int usbdux_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -1236,7 +1236,7 @@ static int usbdux_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
if (cmd->start_src == TRIG_NOW) { if (cmd->start_src == TRIG_NOW) {
/* enable this acquisition operation */ /* enable this acquisition operation */
this_usbduxsub->ai_cmd_running = 1; this_usbduxsub->ai_cmd_running = 1;
ret = usbduxsub_submit_InURBs(this_usbduxsub); ret = usbduxsub_submit_inurbs(this_usbduxsub);
if (ret < 0) { if (ret < 0) {
this_usbduxsub->ai_cmd_running = 0; this_usbduxsub->ai_cmd_running = 0;
/* fixme: unlink here?? */ /* fixme: unlink here?? */
...@@ -1304,7 +1304,7 @@ static int usbdux_ai_insn_read(struct comedi_device *dev, ...@@ -1304,7 +1304,7 @@ static int usbdux_ai_insn_read(struct comedi_device *dev,
up(&this_usbduxsub->sem); up(&this_usbduxsub->sem);
return 0; return 0;
} }
one = le16_to_cpu(this_usbduxsub->insnBuffer[1]); one = le16_to_cpu(this_usbduxsub->insn_buffer[1]);
if (CR_RANGE(insn->chanspec) <= 1) if (CR_RANGE(insn->chanspec) <= 1)
one = one ^ 0x800; one = one ^ 0x800;
...@@ -1334,7 +1334,7 @@ static int usbdux_ao_insn_read(struct comedi_device *dev, ...@@ -1334,7 +1334,7 @@ static int usbdux_ao_insn_read(struct comedi_device *dev,
return -ENODEV; return -ENODEV;
} }
for (i = 0; i < insn->n; i++) for (i = 0; i < insn->n; i++)
data[i] = this_usbduxsub->outBuffer[chan]; data[i] = this_usbduxsub->out_buffer[chan];
up(&this_usbduxsub->sem); up(&this_usbduxsub->sem);
return i; return i;
...@@ -1377,7 +1377,7 @@ static int usbdux_ao_insn_write(struct comedi_device *dev, ...@@ -1377,7 +1377,7 @@ static int usbdux_ao_insn_write(struct comedi_device *dev,
/* one 16 bit value */ /* one 16 bit value */
*((int16_t *) (this_usbduxsub->dux_commands + 2)) = *((int16_t *) (this_usbduxsub->dux_commands + 2)) =
cpu_to_le16(data[i]); cpu_to_le16(data[i]);
this_usbduxsub->outBuffer[chan] = data[i]; this_usbduxsub->out_buffer[chan] = data[i];
/* channel number */ /* channel number */
this_usbduxsub->dux_commands[4] = (chan << 6); this_usbduxsub->dux_commands[4] = (chan << 6);
err = send_dux_commands(this_usbduxsub, SENDDACOMMANDS); err = send_dux_commands(this_usbduxsub, SENDDACOMMANDS);
...@@ -1414,7 +1414,7 @@ static int usbdux_ao_inttrig(struct comedi_device *dev, ...@@ -1414,7 +1414,7 @@ static int usbdux_ao_inttrig(struct comedi_device *dev,
} }
if (!(this_usbduxsub->ao_cmd_running)) { if (!(this_usbduxsub->ao_cmd_running)) {
this_usbduxsub->ao_cmd_running = 1; this_usbduxsub->ao_cmd_running = 1;
ret = usbduxsub_submit_OutURBs(this_usbduxsub); ret = usbduxsub_submit_outurbs(this_usbduxsub);
if (ret < 0) { if (ret < 0) {
dev_err(&this_usbduxsub->interface->dev, dev_err(&this_usbduxsub->interface->dev,
"comedi%d: usbdux_ao_inttrig: submitURB: " "comedi%d: usbdux_ao_inttrig: submitURB: "
...@@ -1609,7 +1609,7 @@ static int usbdux_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -1609,7 +1609,7 @@ static int usbdux_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
if (cmd->start_src == TRIG_NOW) { if (cmd->start_src == TRIG_NOW) {
/* enable this acquisition operation */ /* enable this acquisition operation */
this_usbduxsub->ao_cmd_running = 1; this_usbduxsub->ao_cmd_running = 1;
ret = usbduxsub_submit_OutURBs(this_usbduxsub); ret = usbduxsub_submit_outurbs(this_usbduxsub);
if (ret < 0) { if (ret < 0) {
this_usbduxsub->ao_cmd_running = 0; this_usbduxsub->ao_cmd_running = 0;
/* fixme: unlink here?? */ /* fixme: unlink here?? */
...@@ -1697,7 +1697,7 @@ static int usbdux_dio_insn_bits(struct comedi_device *dev, ...@@ -1697,7 +1697,7 @@ static int usbdux_dio_insn_bits(struct comedi_device *dev,
return err; return err;
} }
data[1] = le16_to_cpu(this_usbduxsub->insnBuffer[1]); data[1] = le16_to_cpu(this_usbduxsub->insn_buffer[1]);
up(&this_usbduxsub->sem); up(&this_usbduxsub->sem);
return insn->n; return insn->n;
} }
...@@ -1733,7 +1733,7 @@ static int usbdux_counter_read(struct comedi_device *dev, ...@@ -1733,7 +1733,7 @@ static int usbdux_counter_read(struct comedi_device *dev,
return err; return err;
} }
data[0] = le16_to_cpu(this_usbduxsub->insnBuffer[chan + 1]); data[0] = le16_to_cpu(this_usbduxsub->insn_buffer[chan + 1]);
up(&this_usbduxsub->sem); up(&this_usbduxsub->sem);
return 1; return 1;
} }
...@@ -1780,13 +1780,13 @@ static int usbdux_counter_config(struct comedi_device *dev, ...@@ -1780,13 +1780,13 @@ static int usbdux_counter_config(struct comedi_device *dev,
/***********************************/ /***********************************/
/* PWM */ /* PWM */
static int usbduxsub_unlink_PwmURBs(struct usbduxsub *usbduxsub_tmp) static int usbduxsub_unlink_pwm_urbs(struct usbduxsub *usbduxsub_tmp)
{ {
int err = 0; int err = 0;
if (usbduxsub_tmp && usbduxsub_tmp->urbPwm) { if (usbduxsub_tmp && usbduxsub_tmp->urb_pwm) {
if (usbduxsub_tmp->urbPwm) if (usbduxsub_tmp->urb_pwm)
usb_kill_urb(usbduxsub_tmp->urbPwm); usb_kill_urb(usbduxsub_tmp->urb_pwm);
dev_dbg(&usbduxsub_tmp->interface->dev, dev_dbg(&usbduxsub_tmp->interface->dev,
"comedi: unlinked PwmURB: res=%d\n", err); "comedi: unlinked PwmURB: res=%d\n", err);
} }
...@@ -1805,7 +1805,7 @@ static int usbdux_pwm_stop(struct usbduxsub *this_usbduxsub, int do_unlink) ...@@ -1805,7 +1805,7 @@ static int usbdux_pwm_stop(struct usbduxsub *this_usbduxsub, int do_unlink)
dev_dbg(&this_usbduxsub->interface->dev, "comedi: %s\n", __func__); dev_dbg(&this_usbduxsub->interface->dev, "comedi: %s\n", __func__);
if (do_unlink) if (do_unlink)
ret = usbduxsub_unlink_PwmURBs(this_usbduxsub); ret = usbduxsub_unlink_pwm_urbs(this_usbduxsub);
this_usbduxsub->pwm_cmd_running = 0; this_usbduxsub->pwm_cmd_running = 0;
...@@ -1878,7 +1878,7 @@ static void usbduxsub_pwm_irq(struct urb *urb) ...@@ -1878,7 +1878,7 @@ static void usbduxsub_pwm_irq(struct urb *urb)
if (!(this_usbduxsub->pwm_cmd_running)) if (!(this_usbduxsub->pwm_cmd_running))
return; return;
urb->transfer_buffer_length = this_usbduxsub->sizePwmBuf; urb->transfer_buffer_length = this_usbduxsub->size_pwm_buf;
urb->dev = this_usbduxsub->usbdev; urb->dev = this_usbduxsub->usbdev;
urb->status = 0; urb->status = 0;
if (this_usbduxsub->pwm_cmd_running) { if (this_usbduxsub->pwm_cmd_running) {
...@@ -1898,9 +1898,9 @@ static void usbduxsub_pwm_irq(struct urb *urb) ...@@ -1898,9 +1898,9 @@ static void usbduxsub_pwm_irq(struct urb *urb)
} }
} }
static int usbduxsub_submit_PwmURBs(struct usbduxsub *usbduxsub) static int usbduxsub_submit_pwm_urbs(struct usbduxsub *usbduxsub)
{ {
int errFlag; int err_flag;
if (!usbduxsub) if (!usbduxsub)
return -EFAULT; return -EFAULT;
...@@ -1908,19 +1908,19 @@ static int usbduxsub_submit_PwmURBs(struct usbduxsub *usbduxsub) ...@@ -1908,19 +1908,19 @@ static int usbduxsub_submit_PwmURBs(struct usbduxsub *usbduxsub)
dev_dbg(&usbduxsub->interface->dev, "comedi_: submitting pwm-urb\n"); dev_dbg(&usbduxsub->interface->dev, "comedi_: submitting pwm-urb\n");
/* in case of a resubmission after an unlink... */ /* in case of a resubmission after an unlink... */
usb_fill_bulk_urb(usbduxsub->urbPwm, usb_fill_bulk_urb(usbduxsub->urb_pwm,
usbduxsub->usbdev, usbduxsub->usbdev,
usb_sndbulkpipe(usbduxsub->usbdev, PWM_EP), usb_sndbulkpipe(usbduxsub->usbdev, PWM_EP),
usbduxsub->urbPwm->transfer_buffer, usbduxsub->urb_pwm->transfer_buffer,
usbduxsub->sizePwmBuf, usbduxsub_pwm_irq, usbduxsub->size_pwm_buf, usbduxsub_pwm_irq,
usbduxsub->comedidev); usbduxsub->comedidev);
errFlag = usb_submit_urb(usbduxsub->urbPwm, GFP_ATOMIC); err_flag = usb_submit_urb(usbduxsub->urb_pwm, GFP_ATOMIC);
if (errFlag) { if (err_flag) {
dev_err(&usbduxsub->interface->dev, dev_err(&usbduxsub->interface->dev,
"comedi_: usbdux: pwm: usb_submit_urb error %d\n", "comedi_: usbdux: pwm: usb_submit_urb error %d\n",
errFlag); err_flag);
return errFlag; return err_flag;
} }
return 0; return 0;
} }
...@@ -1945,8 +1945,8 @@ static int usbdux_pwm_period(struct comedi_device *dev, ...@@ -1945,8 +1945,8 @@ static int usbdux_pwm_period(struct comedi_device *dev,
return -EAGAIN; return -EAGAIN;
} }
} }
this_usbduxsub->pwmDelay = fx2delay; this_usbduxsub->pwn_delay = fx2delay;
this_usbduxsub->pwmPeriod = period; this_usbduxsub->pwm_period = period;
dev_dbg(&this_usbduxsub->interface->dev, "%s: frequ=%d, period=%d\n", dev_dbg(&this_usbduxsub->interface->dev, "%s: frequ=%d, period=%d\n",
__func__, period, fx2delay); __func__, period, fx2delay);
return 0; return 0;
...@@ -1967,17 +1967,17 @@ static int usbdux_pwm_start(struct comedi_device *dev, ...@@ -1967,17 +1967,17 @@ static int usbdux_pwm_start(struct comedi_device *dev,
return 0; return 0;
} }
this_usbduxsub->dux_commands[1] = ((int8_t) this_usbduxsub->pwmDelay); this_usbduxsub->dux_commands[1] = ((int8_t) this_usbduxsub->pwn_delay);
ret = send_dux_commands(this_usbduxsub, SENDPWMON); ret = send_dux_commands(this_usbduxsub, SENDPWMON);
if (ret < 0) if (ret < 0)
return ret; return ret;
/* initialise the buffer */ /* initialise the buffer */
for (i = 0; i < this_usbduxsub->sizePwmBuf; i++) for (i = 0; i < this_usbduxsub->size_pwm_buf; i++)
((char *)(this_usbduxsub->urbPwm->transfer_buffer))[i] = 0; ((char *)(this_usbduxsub->urb_pwm->transfer_buffer))[i] = 0;
this_usbduxsub->pwm_cmd_running = 1; this_usbduxsub->pwm_cmd_running = 1;
ret = usbduxsub_submit_PwmURBs(this_usbduxsub); ret = usbduxsub_submit_pwm_urbs(this_usbduxsub);
if (ret < 0) { if (ret < 0) {
this_usbduxsub->pwm_cmd_running = 0; this_usbduxsub->pwm_cmd_running = 0;
return ret; return ret;
...@@ -1992,7 +1992,7 @@ static int usbdux_pwm_pattern(struct comedi_device *dev, ...@@ -1992,7 +1992,7 @@ static int usbdux_pwm_pattern(struct comedi_device *dev,
{ {
struct usbduxsub *this_usbduxsub = dev->private; struct usbduxsub *this_usbduxsub = dev->private;
int i, szbuf; int i, szbuf;
char *pBuf; char *p_buf;
char pwm_mask; char pwm_mask;
char sgn_mask; char sgn_mask;
char c; char c;
...@@ -2006,10 +2006,10 @@ static int usbdux_pwm_pattern(struct comedi_device *dev, ...@@ -2006,10 +2006,10 @@ static int usbdux_pwm_pattern(struct comedi_device *dev,
sgn_mask = (16 << channel); sgn_mask = (16 << channel);
/* this is the buffer which will be filled with the with bit */ /* this is the buffer which will be filled with the with bit */
/* pattern for one period */ /* pattern for one period */
szbuf = this_usbduxsub->sizePwmBuf; szbuf = this_usbduxsub->size_pwm_buf;
pBuf = (char *)(this_usbduxsub->urbPwm->transfer_buffer); p_buf = (char *)(this_usbduxsub->urb_pwm->transfer_buffer);
for (i = 0; i < szbuf; i++) { for (i = 0; i < szbuf; i++) {
c = *pBuf; c = *p_buf;
/* reset bits */ /* reset bits */
c = c & (~pwm_mask); c = c & (~pwm_mask);
/* set the bit as long as the index is lower than the value */ /* set the bit as long as the index is lower than the value */
...@@ -2023,7 +2023,7 @@ static int usbdux_pwm_pattern(struct comedi_device *dev, ...@@ -2023,7 +2023,7 @@ static int usbdux_pwm_pattern(struct comedi_device *dev,
/* negative value */ /* negative value */
c = c | sgn_mask; c = c | sgn_mask;
} }
*(pBuf++) = c; *(p_buf++) = c;
} }
return 1; return 1;
} }
...@@ -2095,7 +2095,7 @@ static int usbdux_pwm_config(struct comedi_device *dev, ...@@ -2095,7 +2095,7 @@ static int usbdux_pwm_config(struct comedi_device *dev,
"comedi%d: %s: setting period\n", dev->minor, __func__); "comedi%d: %s: setting period\n", dev->minor, __func__);
return usbdux_pwm_period(dev, s, data[1]); return usbdux_pwm_period(dev, s, data[1]);
case INSN_CONFIG_PWM_GET_PERIOD: case INSN_CONFIG_PWM_GET_PERIOD:
data[1] = this_usbduxsub->pwmPeriod; data[1] = this_usbduxsub->pwm_period;
return 0; return 0;
case INSN_CONFIG_PWM_SET_H_BRIDGE: case INSN_CONFIG_PWM_SET_H_BRIDGE:
/* value in the first byte and the sign in the second for a /* value in the first byte and the sign in the second for a
...@@ -2131,55 +2131,55 @@ static void tidy_up(struct usbduxsub *usbduxsub_tmp) ...@@ -2131,55 +2131,55 @@ static void tidy_up(struct usbduxsub *usbduxsub_tmp)
usbduxsub_tmp->probed = 0; usbduxsub_tmp->probed = 0;
if (usbduxsub_tmp->urbIn) { if (usbduxsub_tmp->urb_in) {
if (usbduxsub_tmp->ai_cmd_running) { if (usbduxsub_tmp->ai_cmd_running) {
usbduxsub_tmp->ai_cmd_running = 0; usbduxsub_tmp->ai_cmd_running = 0;
usbduxsub_unlink_InURBs(usbduxsub_tmp); usbduxsub_unlink_inurbs(usbduxsub_tmp);
} }
for (i = 0; i < usbduxsub_tmp->numOfInBuffers; i++) { for (i = 0; i < usbduxsub_tmp->num_in_buffers; i++) {
kfree(usbduxsub_tmp->urbIn[i]->transfer_buffer); kfree(usbduxsub_tmp->urb_in[i]->transfer_buffer);
usbduxsub_tmp->urbIn[i]->transfer_buffer = NULL; usbduxsub_tmp->urb_in[i]->transfer_buffer = NULL;
usb_kill_urb(usbduxsub_tmp->urbIn[i]); usb_kill_urb(usbduxsub_tmp->urb_in[i]);
usb_free_urb(usbduxsub_tmp->urbIn[i]); usb_free_urb(usbduxsub_tmp->urb_in[i]);
usbduxsub_tmp->urbIn[i] = NULL; usbduxsub_tmp->urb_in[i] = NULL;
} }
kfree(usbduxsub_tmp->urbIn); kfree(usbduxsub_tmp->urb_in);
usbduxsub_tmp->urbIn = NULL; usbduxsub_tmp->urb_in = NULL;
} }
if (usbduxsub_tmp->urbOut) { if (usbduxsub_tmp->urb_out) {
if (usbduxsub_tmp->ao_cmd_running) { if (usbduxsub_tmp->ao_cmd_running) {
usbduxsub_tmp->ao_cmd_running = 0; usbduxsub_tmp->ao_cmd_running = 0;
usbduxsub_unlink_OutURBs(usbduxsub_tmp); usbduxsub_unlink_outurbs(usbduxsub_tmp);
} }
for (i = 0; i < usbduxsub_tmp->numOfOutBuffers; i++) { for (i = 0; i < usbduxsub_tmp->num_out_buffers; i++) {
kfree(usbduxsub_tmp->urbOut[i]->transfer_buffer); kfree(usbduxsub_tmp->urb_out[i]->transfer_buffer);
usbduxsub_tmp->urbOut[i]->transfer_buffer = NULL; usbduxsub_tmp->urb_out[i]->transfer_buffer = NULL;
if (usbduxsub_tmp->urbOut[i]) { if (usbduxsub_tmp->urb_out[i]) {
usb_kill_urb(usbduxsub_tmp->urbOut[i]); usb_kill_urb(usbduxsub_tmp->urb_out[i]);
usb_free_urb(usbduxsub_tmp->urbOut[i]); usb_free_urb(usbduxsub_tmp->urb_out[i]);
usbduxsub_tmp->urbOut[i] = NULL; usbduxsub_tmp->urb_out[i] = NULL;
} }
} }
kfree(usbduxsub_tmp->urbOut); kfree(usbduxsub_tmp->urb_out);
usbduxsub_tmp->urbOut = NULL; usbduxsub_tmp->urb_out = NULL;
} }
if (usbduxsub_tmp->urbPwm) { if (usbduxsub_tmp->urb_pwm) {
if (usbduxsub_tmp->pwm_cmd_running) { if (usbduxsub_tmp->pwm_cmd_running) {
usbduxsub_tmp->pwm_cmd_running = 0; usbduxsub_tmp->pwm_cmd_running = 0;
usbduxsub_unlink_PwmURBs(usbduxsub_tmp); usbduxsub_unlink_pwm_urbs(usbduxsub_tmp);
} }
kfree(usbduxsub_tmp->urbPwm->transfer_buffer); kfree(usbduxsub_tmp->urb_pwm->transfer_buffer);
usbduxsub_tmp->urbPwm->transfer_buffer = NULL; usbduxsub_tmp->urb_pwm->transfer_buffer = NULL;
usb_kill_urb(usbduxsub_tmp->urbPwm); usb_kill_urb(usbduxsub_tmp->urb_pwm);
usb_free_urb(usbduxsub_tmp->urbPwm); usb_free_urb(usbduxsub_tmp->urb_pwm);
usbduxsub_tmp->urbPwm = NULL; usbduxsub_tmp->urb_pwm = NULL;
} }
kfree(usbduxsub_tmp->inBuffer); kfree(usbduxsub_tmp->in_buffer);
usbduxsub_tmp->inBuffer = NULL; usbduxsub_tmp->in_buffer = NULL;
kfree(usbduxsub_tmp->insnBuffer); kfree(usbduxsub_tmp->insn_buffer);
usbduxsub_tmp->insnBuffer = NULL; usbduxsub_tmp->insn_buffer = NULL;
kfree(usbduxsub_tmp->outBuffer); kfree(usbduxsub_tmp->out_buffer);
usbduxsub_tmp->outBuffer = NULL; usbduxsub_tmp->out_buffer = NULL;
kfree(usbduxsub_tmp->dac_commands); kfree(usbduxsub_tmp->dac_commands);
usbduxsub_tmp->dac_commands = NULL; usbduxsub_tmp->dac_commands = NULL;
kfree(usbduxsub_tmp->dux_commands); kfree(usbduxsub_tmp->dux_commands);
...@@ -2302,7 +2302,7 @@ static int usbdux_attach_common(struct comedi_device *dev, ...@@ -2302,7 +2302,7 @@ static int usbdux_attach_common(struct comedi_device *dev,
s->subdev_flags = SDF_WRITABLE | SDF_PWM_HBRIDGE; s->subdev_flags = SDF_WRITABLE | SDF_PWM_HBRIDGE;
s->n_chan = 8; s->n_chan = 8;
/* this defines the max duty cycle resolution */ /* this defines the max duty cycle resolution */
s->maxdata = udev->sizePwmBuf; s->maxdata = udev->size_pwm_buf;
s->insn_write = usbdux_pwm_write; s->insn_write = usbdux_pwm_write;
s->insn_read = usbdux_pwm_read; s->insn_read = usbdux_pwm_read;
s->insn_config = usbdux_pwm_config; s->insn_config = usbdux_pwm_config;
...@@ -2381,7 +2381,7 @@ static void usbdux_firmware_request_complete_handler(const struct firmware *fw, ...@@ -2381,7 +2381,7 @@ static void usbdux_firmware_request_complete_handler(const struct firmware *fw,
* we need to upload the firmware here because fw will be * we need to upload the firmware here because fw will be
* freed once we've left this function * freed once we've left this function
*/ */
ret = firmwareUpload(usbduxsub_tmp, fw->data, fw->size); ret = firmware_upload(usbduxsub_tmp, fw->data, fw->size);
if (ret) { if (ret) {
dev_err(&uinterf->dev, dev_err(&uinterf->dev,
...@@ -2457,22 +2457,22 @@ static int usbdux_usb_probe(struct usb_interface *uinterf, ...@@ -2457,22 +2457,22 @@ static int usbdux_usb_probe(struct usb_interface *uinterf,
return -ENOMEM; return -ENOMEM;
} }
/* create space for the in buffer and set it to zero */ /* create space for the in buffer and set it to zero */
usbduxsub[index].inBuffer = kzalloc(SIZEINBUF, GFP_KERNEL); usbduxsub[index].in_buffer = kzalloc(SIZEINBUF, GFP_KERNEL);
if (!(usbduxsub[index].inBuffer)) { if (!(usbduxsub[index].in_buffer)) {
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
} }
/* create space of the instruction buffer */ /* create space of the instruction buffer */
usbduxsub[index].insnBuffer = kzalloc(SIZEINSNBUF, GFP_KERNEL); usbduxsub[index].insn_buffer = kzalloc(SIZEINSNBUF, GFP_KERNEL);
if (!(usbduxsub[index].insnBuffer)) { if (!(usbduxsub[index].insn_buffer)) {
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
} }
/* create space for the outbuffer */ /* create space for the outbuffer */
usbduxsub[index].outBuffer = kzalloc(SIZEOUTBUF, GFP_KERNEL); usbduxsub[index].out_buffer = kzalloc(SIZEOUTBUF, GFP_KERNEL);
if (!(usbduxsub[index].outBuffer)) { if (!(usbduxsub[index].out_buffer)) {
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
...@@ -2489,124 +2489,124 @@ static int usbdux_usb_probe(struct usb_interface *uinterf, ...@@ -2489,124 +2489,124 @@ static int usbdux_usb_probe(struct usb_interface *uinterf,
return -ENODEV; return -ENODEV;
} }
if (usbduxsub[index].high_speed) if (usbduxsub[index].high_speed)
usbduxsub[index].numOfInBuffers = NUMOFINBUFFERSHIGH; usbduxsub[index].num_in_buffers = NUMOFINBUFFERSHIGH;
else else
usbduxsub[index].numOfInBuffers = NUMOFINBUFFERSFULL; usbduxsub[index].num_in_buffers = NUMOFINBUFFERSFULL;
usbduxsub[index].urbIn = usbduxsub[index].urb_in =
kcalloc(usbduxsub[index].numOfInBuffers, sizeof(struct urb *), kcalloc(usbduxsub[index].num_in_buffers, sizeof(struct urb *),
GFP_KERNEL); GFP_KERNEL);
if (!(usbduxsub[index].urbIn)) { if (!(usbduxsub[index].urb_in)) {
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
} }
for (i = 0; i < usbduxsub[index].numOfInBuffers; i++) { for (i = 0; i < usbduxsub[index].num_in_buffers; i++) {
/* one frame: 1ms */ /* one frame: 1ms */
usbduxsub[index].urbIn[i] = usb_alloc_urb(1, GFP_KERNEL); usbduxsub[index].urb_in[i] = usb_alloc_urb(1, GFP_KERNEL);
if (usbduxsub[index].urbIn[i] == NULL) { if (usbduxsub[index].urb_in[i] == NULL) {
dev_err(dev, "comedi_: usbdux%d: " dev_err(dev, "comedi_: usbdux%d: "
"Could not alloc. urb(%d)\n", index, i); "Could not alloc. urb(%d)\n", index, i);
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
} }
usbduxsub[index].urbIn[i]->dev = usbduxsub[index].usbdev; usbduxsub[index].urb_in[i]->dev = usbduxsub[index].usbdev;
/* will be filled later with a pointer to the comedi-device */ /* will be filled later with a pointer to the comedi-device */
/* and ONLY then the urb should be submitted */ /* and ONLY then the urb should be submitted */
usbduxsub[index].urbIn[i]->context = NULL; usbduxsub[index].urb_in[i]->context = NULL;
usbduxsub[index].urbIn[i]->pipe = usbduxsub[index].urb_in[i]->pipe =
usb_rcvisocpipe(usbduxsub[index].usbdev, ISOINEP); usb_rcvisocpipe(usbduxsub[index].usbdev, ISOINEP);
usbduxsub[index].urbIn[i]->transfer_flags = URB_ISO_ASAP; usbduxsub[index].urb_in[i]->transfer_flags = URB_ISO_ASAP;
usbduxsub[index].urbIn[i]->transfer_buffer = usbduxsub[index].urb_in[i]->transfer_buffer =
kzalloc(SIZEINBUF, GFP_KERNEL); kzalloc(SIZEINBUF, GFP_KERNEL);
if (!(usbduxsub[index].urbIn[i]->transfer_buffer)) { if (!(usbduxsub[index].urb_in[i]->transfer_buffer)) {
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
} }
usbduxsub[index].urbIn[i]->complete = usbduxsub_ai_IsocIrq; usbduxsub[index].urb_in[i]->complete = usbduxsub_ai_isoc_irq;
usbduxsub[index].urbIn[i]->number_of_packets = 1; usbduxsub[index].urb_in[i]->number_of_packets = 1;
usbduxsub[index].urbIn[i]->transfer_buffer_length = SIZEINBUF; usbduxsub[index].urb_in[i]->transfer_buffer_length = SIZEINBUF;
usbduxsub[index].urbIn[i]->iso_frame_desc[0].offset = 0; usbduxsub[index].urb_in[i]->iso_frame_desc[0].offset = 0;
usbduxsub[index].urbIn[i]->iso_frame_desc[0].length = SIZEINBUF; usbduxsub[index].urb_in[i]->iso_frame_desc[0].length = SIZEINBUF;
} }
/* out */ /* out */
if (usbduxsub[index].high_speed) if (usbduxsub[index].high_speed)
usbduxsub[index].numOfOutBuffers = NUMOFOUTBUFFERSHIGH; usbduxsub[index].num_out_buffers = NUMOFOUTBUFFERSHIGH;
else else
usbduxsub[index].numOfOutBuffers = NUMOFOUTBUFFERSFULL; usbduxsub[index].num_out_buffers = NUMOFOUTBUFFERSFULL;
usbduxsub[index].urbOut = usbduxsub[index].urb_out =
kcalloc(usbduxsub[index].numOfOutBuffers, sizeof(struct urb *), kcalloc(usbduxsub[index].num_out_buffers, sizeof(struct urb *),
GFP_KERNEL); GFP_KERNEL);
if (!(usbduxsub[index].urbOut)) { if (!(usbduxsub[index].urb_out)) {
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
} }
for (i = 0; i < usbduxsub[index].numOfOutBuffers; i++) { for (i = 0; i < usbduxsub[index].num_out_buffers; i++) {
/* one frame: 1ms */ /* one frame: 1ms */
usbduxsub[index].urbOut[i] = usb_alloc_urb(1, GFP_KERNEL); usbduxsub[index].urb_out[i] = usb_alloc_urb(1, GFP_KERNEL);
if (usbduxsub[index].urbOut[i] == NULL) { if (usbduxsub[index].urb_out[i] == NULL) {
dev_err(dev, "comedi_: usbdux%d: " dev_err(dev, "comedi_: usbdux%d: "
"Could not alloc. urb(%d)\n", index, i); "Could not alloc. urb(%d)\n", index, i);
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
} }
usbduxsub[index].urbOut[i]->dev = usbduxsub[index].usbdev; usbduxsub[index].urb_out[i]->dev = usbduxsub[index].usbdev;
/* will be filled later with a pointer to the comedi-device */ /* will be filled later with a pointer to the comedi-device */
/* and ONLY then the urb should be submitted */ /* and ONLY then the urb should be submitted */
usbduxsub[index].urbOut[i]->context = NULL; usbduxsub[index].urb_out[i]->context = NULL;
usbduxsub[index].urbOut[i]->pipe = usbduxsub[index].urb_out[i]->pipe =
usb_sndisocpipe(usbduxsub[index].usbdev, ISOOUTEP); usb_sndisocpipe(usbduxsub[index].usbdev, ISOOUTEP);
usbduxsub[index].urbOut[i]->transfer_flags = URB_ISO_ASAP; usbduxsub[index].urb_out[i]->transfer_flags = URB_ISO_ASAP;
usbduxsub[index].urbOut[i]->transfer_buffer = usbduxsub[index].urb_out[i]->transfer_buffer =
kzalloc(SIZEOUTBUF, GFP_KERNEL); kzalloc(SIZEOUTBUF, GFP_KERNEL);
if (!(usbduxsub[index].urbOut[i]->transfer_buffer)) { if (!(usbduxsub[index].urb_out[i]->transfer_buffer)) {
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
} }
usbduxsub[index].urbOut[i]->complete = usbduxsub_ao_IsocIrq; usbduxsub[index].urb_out[i]->complete = usbduxsub_ao_isoc_irq;
usbduxsub[index].urbOut[i]->number_of_packets = 1; usbduxsub[index].urb_out[i]->number_of_packets = 1;
usbduxsub[index].urbOut[i]->transfer_buffer_length = SIZEOUTBUF; usbduxsub[index].urb_out[i]->transfer_buffer_length = SIZEOUTBUF;
usbduxsub[index].urbOut[i]->iso_frame_desc[0].offset = 0; usbduxsub[index].urb_out[i]->iso_frame_desc[0].offset = 0;
usbduxsub[index].urbOut[i]->iso_frame_desc[0].length = usbduxsub[index].urb_out[i]->iso_frame_desc[0].length =
SIZEOUTBUF; SIZEOUTBUF;
if (usbduxsub[index].high_speed) { if (usbduxsub[index].high_speed) {
/* uframes */ /* uframes */
usbduxsub[index].urbOut[i]->interval = 8; usbduxsub[index].urb_out[i]->interval = 8;
} else { } else {
/* frames */ /* frames */
usbduxsub[index].urbOut[i]->interval = 1; usbduxsub[index].urb_out[i]->interval = 1;
} }
} }
/* pwm */ /* pwm */
if (usbduxsub[index].high_speed) { if (usbduxsub[index].high_speed) {
/* max bulk ep size in high speed */ /* max bulk ep size in high speed */
usbduxsub[index].sizePwmBuf = 512; usbduxsub[index].size_pwm_buf = 512;
usbduxsub[index].urbPwm = usb_alloc_urb(0, GFP_KERNEL); usbduxsub[index].urb_pwm = usb_alloc_urb(0, GFP_KERNEL);
if (usbduxsub[index].urbPwm == NULL) { if (usbduxsub[index].urb_pwm == NULL) {
dev_err(dev, "comedi_: usbdux%d: " dev_err(dev, "comedi_: usbdux%d: "
"Could not alloc. pwm urb\n", index); "Could not alloc. pwm urb\n", index);
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
} }
usbduxsub[index].urbPwm->transfer_buffer = usbduxsub[index].urb_pwm->transfer_buffer =
kzalloc(usbduxsub[index].sizePwmBuf, GFP_KERNEL); kzalloc(usbduxsub[index].size_pwm_buf, GFP_KERNEL);
if (!(usbduxsub[index].urbPwm->transfer_buffer)) { if (!(usbduxsub[index].urb_pwm->transfer_buffer)) {
tidy_up(&(usbduxsub[index])); tidy_up(&(usbduxsub[index]));
up(&start_stop_sem); up(&start_stop_sem);
return -ENOMEM; return -ENOMEM;
} }
} else { } else {
usbduxsub[index].urbPwm = NULL; usbduxsub[index].urb_pwm = NULL;
usbduxsub[index].sizePwmBuf = 0; usbduxsub[index].size_pwm_buf = 0;
} }
usbduxsub[index].ai_cmd_running = 0; usbduxsub[index].ai_cmd_running = 0;
......
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