#include <linux/compiler.h>
#include "../comedidev.h"
-#include "../usb.h"
#define BOARDNAME "usbdux"
urb->dev = this_usbduxsub->usbdev;
/* resubmit the urb */
- err = USB_SUBMIT_URB(urb);
+ err = usb_submit_urb(urb, GFP_ATOMIC);
if (unlikely(err < 0)) {
dev_err(&urb->dev->dev,
"comedi_: urb resubmit failed in int-context! err=%d\n",
urb->iso_frame_desc[0].offset = 0;
urb->iso_frame_desc[0].length = SIZEOUTBUF;
urb->iso_frame_desc[0].status = 0;
- ret = USB_SUBMIT_URB(urb);
+ ret = usb_submit_urb(urb, GFP_ATOMIC);
if (ret < 0) {
dev_err(&urb->dev->dev,
"comedi_: ao urb resubm failed in int-cont. "
if (usbduxsub->probed) {
/* 7f92 to zero */
local_transfer_buffer[0] = 0;
- errcode = USB_CONTROL_MSG(usbduxsub->usbdev,
+ errcode = usb_control_msg(usbduxsub->usbdev,
/* create a pipe for a control transfer */
usb_sndctrlpipe(usbduxsub->usbdev, 0),
/* bRequest, "Firmware" */
if (usbduxsub->probed) {
/* 7f92 to one */
local_transfer_buffer[0] = 1;
- errcode = USB_CONTROL_MSG
- (usbduxsub->usbdev,
+ errcode = usb_control_msg(usbduxsub->usbdev,
usb_sndctrlpipe(usbduxsub->usbdev, 0),
/* bRequest, "Firmware" */
USBDUXSUB_FIRMWARE,
" to addr %d, first byte=%d.\n",
usbduxsub->comedidev->minor, len,
startAddr, local_transfer_buffer[0]);
- errcode = USB_CONTROL_MSG
- (usbduxsub->usbdev,
+ errcode = usb_control_msg(usbduxsub->usbdev,
usb_sndctrlpipe(usbduxsub->usbdev, 0),
/* brequest, firmware */
USBDUXSUB_FIRMWARE,
(usbduxsub->urbIn[i]->context),
(usbduxsub->urbIn[i]->dev),
(usbduxsub->urbIn[i]->interval));
- errFlag = USB_SUBMIT_URB(usbduxsub->urbIn[i]);
+ errFlag = usb_submit_urb(usbduxsub->urbIn[i], GFP_ATOMIC);
if (errFlag) {
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);
return errFlag;
}
usbduxsub->urbOut[i]->dev = usbduxsub->usbdev;
usbduxsub->urbOut[i]->status = 0;
usbduxsub->urbOut[i]->transfer_flags = URB_ISO_ASAP;
- errFlag = USB_SUBMIT_URB(usbduxsub->urbOut[i]);
+ errFlag = usb_submit_urb(usbduxsub->urbOut[i], GFP_ATOMIC);
if (errFlag) {
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);
return errFlag;
}
printk(" %02x", this_usbduxsub->dux_commands[result]);
printk("\n");
#endif
- result = USB_BULK_MSG(this_usbduxsub->usbdev,
- usb_sndbulkpipe(this_usbduxsub->usbdev,
- COMMAND_OUT_EP),
- this_usbduxsub->dux_commands, SIZEOFDUXBUFFER, &nsent, 10 * HZ);
+ result = usb_bulk_msg(this_usbduxsub->usbdev,
+ usb_sndbulkpipe(this_usbduxsub->usbdev,
+ COMMAND_OUT_EP),
+ this_usbduxsub->dux_commands, SIZEOFDUXBUFFER,
+ &nsent, 10);
if (result < 0)
dev_err(&this_usbduxsub->interface->dev, "comedi%d: "
"could not transmit dux_command to the usb-device, "
int i;
for (i = 0; i < RETRIES; i++) {
- result = USB_BULK_MSG(this_usbduxsub->usbdev,
- usb_rcvbulkpipe(this_usbduxsub->usbdev,
- COMMAND_IN_EP),
- this_usbduxsub->insnBuffer, SIZEINSNBUF, &nrec, 1 * HZ);
+ result = usb_bulk_msg(this_usbduxsub->usbdev,
+ usb_rcvbulkpipe(this_usbduxsub->usbdev,
+ COMMAND_IN_EP),
+ this_usbduxsub->insnBuffer, SIZEINSNBUF,
+ &nrec, 1);
if (result < 0) {
dev_err(&this_usbduxsub->interface->dev, "comedi%d: "
"insn: USB error %d while receiving DUX command"
urb->dev = this_usbduxsub->usbdev;
urb->status = 0;
if (this_usbduxsub->pwm_cmd_running) {
- ret = USB_SUBMIT_URB(urb);
+ ret = usb_submit_urb(urb, GFP_ATOMIC);
if (ret < 0) {
dev_err(&this_usbduxsub->interface->dev,
"comedi_: pwm urb resubm failed in int-cont. "
usbduxsub->urbPwm->transfer_buffer,
usbduxsub->sizePwmBuf, usbduxsub_pwm_irq, usbduxsub->comedidev);
- errFlag = USB_SUBMIT_URB(usbduxsub->urbPwm);
+ errFlag = usb_submit_urb(usbduxsub->urbPwm, GFP_ATOMIC);
if (errFlag) {
dev_err(&usbduxsub->interface->dev,
- "comedi_: usbdux: pwm: USB_SUBMIT_URB error %d\n",
+ "comedi_: usbdux: pwm: usb_submit_urb error %d\n",
errFlag);
return errFlag;
}
if (index == -1) {
dev_err(dev, "Too many usbdux-devices connected.\n");
up(&start_stop_sem);
- return PROBE_ERR_RETURN(-EMFILE);
+ return -EMFILE;
}
dev_dbg(dev, "comedi_: usbdux: "
"usbduxsub[%d] is ready to connect to comedi.\n", index);
"error alloc space for dac commands\n");
tidy_up(&(usbduxsub[index]));
up(&start_stop_sem);
- return PROBE_ERR_RETURN(-ENOMEM);
+ return -ENOMEM;
}
/* create space for the commands going to the usb device */
usbduxsub[index].dux_commands = kzalloc(SIZEOFDUXBUFFER, GFP_KERNEL);
"error alloc space for dac commands\n");
tidy_up(&(usbduxsub[index]));
up(&start_stop_sem);
- return PROBE_ERR_RETURN(-ENOMEM);
+ return -ENOMEM;
}
/* create space for the in buffer and set it to zero */
usbduxsub[index].inBuffer = kzalloc(SIZEINBUF, GFP_KERNEL);
"could not alloc space for inBuffer\n");
tidy_up(&(usbduxsub[index]));
up(&start_stop_sem);
- return PROBE_ERR_RETURN(-ENOMEM);
+ return -ENOMEM;
}
/* create space of the instruction buffer */
usbduxsub[index].insnBuffer = kzalloc(SIZEINSNBUF, GFP_KERNEL);
"could not alloc space for insnBuffer\n");
tidy_up(&(usbduxsub[index]));
up(&start_stop_sem);
- return PROBE_ERR_RETURN(-ENOMEM);
+ return -ENOMEM;
}
/* create space for the outbuffer */
usbduxsub[index].outBuffer = kzalloc(SIZEOUTBUF, GFP_KERNEL);
"could not alloc space for outBuffer\n");
tidy_up(&(usbduxsub[index]));
up(&start_stop_sem);
- return PROBE_ERR_RETURN(-ENOMEM);
+ return -ENOMEM;
}
/* setting to alternate setting 3: enabling iso ep and bulk ep. */
i = usb_set_interface(usbduxsub[index].usbdev,
index);
tidy_up(&(usbduxsub[index]));
up(&start_stop_sem);
- return PROBE_ERR_RETURN(-ENODEV);
+ return -ENODEV;
}
if (usbduxsub[index].high_speed)
usbduxsub[index].numOfInBuffers = NUMOFINBUFFERSHIGH;
dev_err(dev, "comedi_: usbdux: Could not alloc. urbIn array\n");
tidy_up(&(usbduxsub[index]));
up(&start_stop_sem);
- return PROBE_ERR_RETURN(-ENOMEM);
+ return -ENOMEM;
}
for (i = 0; i < usbduxsub[index].numOfInBuffers; i++) {
/* one frame: 1ms */
- usbduxsub[index].urbIn[i] = USB_ALLOC_URB(1);
+ usbduxsub[index].urbIn[i] = usb_alloc_urb(1, GFP_KERNEL);
if (usbduxsub[index].urbIn[i] == NULL) {
dev_err(dev, "comedi_: usbdux%d: "
"Could not alloc. urb(%d)\n", index, i);
tidy_up(&(usbduxsub[index]));
up(&start_stop_sem);
- return PROBE_ERR_RETURN(-ENOMEM);
+ return -ENOMEM;
}
usbduxsub[index].urbIn[i]->dev = usbduxsub[index].usbdev;
/* will be filled later with a pointer to the comedi-device */
"could not alloc. transb.\n", index);
tidy_up(&(usbduxsub[index]));
up(&start_stop_sem);
- return PROBE_ERR_RETURN(-ENOMEM);
+ return -ENOMEM;
}
usbduxsub[index].urbIn[i]->complete = usbduxsub_ai_IsocIrq;
usbduxsub[index].urbIn[i]->number_of_packets = 1;
"Could not alloc. urbOut array\n");
tidy_up(&(usbduxsub[index]));
up(&start_stop_sem);
- return PROBE_ERR_RETURN(-ENOMEM);
+ return -ENOMEM;
}
for (i = 0; i < usbduxsub[index].numOfOutBuffers; i++) {
/* one frame: 1ms */
- usbduxsub[index].urbOut[i] = USB_ALLOC_URB(1);
+ usbduxsub[index].urbOut[i] = usb_alloc_urb(1, GFP_KERNEL);
if (usbduxsub[index].urbOut[i] == NULL) {
dev_err(dev, "comedi_: usbdux%d: "
"Could not alloc. urb(%d)\n", index, i);
tidy_up(&(usbduxsub[index]));
up(&start_stop_sem);
- return PROBE_ERR_RETURN(-ENOMEM);
+ return -ENOMEM;
}
usbduxsub[index].urbOut[i]->dev = usbduxsub[index].usbdev;
/* will be filled later with a pointer to the comedi-device */
"could not alloc. transb.\n", index);
tidy_up(&(usbduxsub[index]));
up(&start_stop_sem);
- return PROBE_ERR_RETURN(-ENOMEM);
+ return -ENOMEM;
}
usbduxsub[index].urbOut[i]->complete = usbduxsub_ao_IsocIrq;
usbduxsub[index].urbOut[i]->number_of_packets = 1;
if (usbduxsub[index].high_speed) {
/* max bulk ep size in high speed */
usbduxsub[index].sizePwmBuf = 512;
- usbduxsub[index].urbPwm = USB_ALLOC_URB(0);
+ usbduxsub[index].urbPwm = usb_alloc_urb(0, GFP_KERNEL);
if (usbduxsub[index].urbPwm == NULL) {
dev_err(dev, "comedi_: usbdux%d: "
"Could not alloc. pwm urb\n", index);
tidy_up(&(usbduxsub[index]));
up(&start_stop_sem);
- return PROBE_ERR_RETURN(-ENOMEM);
+ return -ENOMEM;
}
usbduxsub[index].urbPwm->transfer_buffer =
kzalloc(usbduxsub[index].sizePwmBuf, GFP_KERNEL);
"could not alloc. transb. for pwm\n", index);
tidy_up(&(usbduxsub[index]));
up(&start_stop_sem);
- return PROBE_ERR_RETURN(-ENOMEM);
+ return -ENOMEM;
}
} else {
usbduxsub[index].urbPwm = NULL;