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

staging: comedi: usbdux: tidy up usbduxsub_ao_isoc_irq()

Rename the local variables to the comedi "norm".

The comedi_subdevice in this function is actually the dev->write_subdev
that was initialized in the attach. Use that instead of accessing the
dev->subdevices array directly.

Use dev->class_dev as the device for all dev_printk() messages.

Instead of using the 'comedidev' back pointer in the private data, use
the comedi_device 'dev' that we already have.
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 0a9502f2
...@@ -535,18 +535,11 @@ static int usbdux_ao_cancel(struct comedi_device *dev, ...@@ -535,18 +535,11 @@ static int usbdux_ao_cancel(struct comedi_device *dev,
static void usbduxsub_ao_isoc_irq(struct urb *urb) static void usbduxsub_ao_isoc_irq(struct urb *urb)
{ {
struct comedi_device *dev = urb->context;
struct comedi_subdevice *s = dev->write_subdev;
struct usbdux_private *devpriv = dev->private;
int i, ret; int i, ret;
int8_t *datap; int8_t *datap;
struct usbdux_private *this_usbduxsub;
struct comedi_device *this_comedidev;
struct comedi_subdevice *s;
/* the context variable points to the subdevice */
this_comedidev = urb->context;
/* the private structure of the subdevice is struct usbdux_private */
this_usbduxsub = this_comedidev->private;
s = &this_comedidev->subdevices[SUBDEV_DA];
switch (urb->status) { switch (urb->status) {
case 0: case 0:
...@@ -559,47 +552,47 @@ static void usbduxsub_ao_isoc_irq(struct urb *urb) ...@@ -559,47 +552,47 @@ static void usbduxsub_ao_isoc_irq(struct urb *urb)
case -ECONNABORTED: case -ECONNABORTED:
/* after an unlink command, unplug, ... etc */ /* after an unlink command, unplug, ... etc */
/* no unlink needed here. Already shutting down. */ /* no unlink needed here. Already shutting down. */
if (this_usbduxsub->ao_cmd_running) { if (devpriv->ao_cmd_running) {
s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_EOA;
comedi_event(this_usbduxsub->comedidev, s); comedi_event(dev, s);
usbdux_ao_stop(this_usbduxsub, 0); usbdux_ao_stop(devpriv, 0);
} }
return; return;
default: default:
/* a real error */ /* a real error */
if (this_usbduxsub->ao_cmd_running) { if (devpriv->ao_cmd_running) {
dev_err(&urb->dev->dev, dev_err(dev->class_dev,
"comedi_: Non-zero urb status received in ao " "Non-zero urb status received in ao intr context: %d\n",
"intr context: %d\n", urb->status); urb->status);
s->async->events |= COMEDI_CB_ERROR; s->async->events |= COMEDI_CB_ERROR;
s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_EOA;
comedi_event(this_usbduxsub->comedidev, s); comedi_event(dev, s);
/* we do an unlink if we are in the high speed mode */ /* we do an unlink if we are in the high speed mode */
usbdux_ao_stop(this_usbduxsub, 0); usbdux_ao_stop(devpriv, 0);
} }
return; return;
} }
/* are we actually running? */ /* are we actually running? */
if (!(this_usbduxsub->ao_cmd_running)) if (!devpriv->ao_cmd_running)
return; return;
/* normal operation: executing a command in this subdevice */ /* normal operation: executing a command in this subdevice */
this_usbduxsub->ao_counter--; devpriv->ao_counter--;
if ((int)this_usbduxsub->ao_counter <= 0) { if ((int)devpriv->ao_counter <= 0) {
/* timer zero */ /* timer zero */
this_usbduxsub->ao_counter = this_usbduxsub->ao_timer; devpriv->ao_counter = devpriv->ao_timer;
/* handle non continous acquisition */ /* handle non continous acquisition */
if (!(this_usbduxsub->ao_continous)) { if (!devpriv->ao_continous) {
/* fixed number of samples */ /* fixed number of samples */
this_usbduxsub->ao_sample_count--; devpriv->ao_sample_count--;
if (this_usbduxsub->ao_sample_count < 0) { if (devpriv->ao_sample_count < 0) {
/* all samples transmitted */ /* all samples transmitted */
usbdux_ao_stop(this_usbduxsub, 0); usbdux_ao_stop(devpriv, 0);
s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_EOA;
comedi_event(this_usbduxsub->comedidev, s); comedi_event(dev, s);
/* no resubmit of the urb */ /* no resubmit of the urb */
return; return;
} }
...@@ -619,9 +612,7 @@ static void usbduxsub_ao_isoc_irq(struct urb *urb) ...@@ -619,9 +612,7 @@ static void usbduxsub_ao_isoc_irq(struct urb *urb)
ret = comedi_buf_get(s->async, &temp); ret = comedi_buf_get(s->async, &temp);
datap[0] = temp; datap[0] = temp;
datap[1] = temp >> 8; datap[1] = temp >> 8;
datap[2] = this_usbduxsub->dac_commands[i]; datap[2] = devpriv->dac_commands[i];
/* printk("data[0]=%x, data[1]=%x, data[2]=%x\n", */
/* datap[0],datap[1],datap[2]); */
if (ret < 0) { if (ret < 0) {
dev_err(&urb->dev->dev, dev_err(&urb->dev->dev,
"comedi: buffer underflow\n"); "comedi: buffer underflow\n");
...@@ -630,39 +621,35 @@ static void usbduxsub_ao_isoc_irq(struct urb *urb) ...@@ -630,39 +621,35 @@ static void usbduxsub_ao_isoc_irq(struct urb *urb)
} }
/* transmit data to comedi */ /* transmit data to comedi */
s->async->events |= COMEDI_CB_BLOCK; s->async->events |= COMEDI_CB_BLOCK;
comedi_event(this_usbduxsub->comedidev, s); comedi_event(dev, s);
} }
} }
urb->transfer_buffer_length = SIZEOUTBUF; urb->transfer_buffer_length = SIZEOUTBUF;
urb->dev = this_usbduxsub->usbdev; urb->dev = devpriv->usbdev;
urb->status = 0; urb->status = 0;
if (this_usbduxsub->ao_cmd_running) { if (devpriv->ao_cmd_running) {
if (this_usbduxsub->high_speed) { if (devpriv->high_speed)
/* uframes */ urb->interval = 8; /* uframes */
urb->interval = 8; else
} else { urb->interval = 1; /* frames */
/* frames */
urb->interval = 1;
}
urb->number_of_packets = 1; urb->number_of_packets = 1;
urb->iso_frame_desc[0].offset = 0; urb->iso_frame_desc[0].offset = 0;
urb->iso_frame_desc[0].length = SIZEOUTBUF; urb->iso_frame_desc[0].length = SIZEOUTBUF;
urb->iso_frame_desc[0].status = 0; urb->iso_frame_desc[0].status = 0;
ret = usb_submit_urb(urb, GFP_ATOMIC); ret = usb_submit_urb(urb, GFP_ATOMIC);
if (ret < 0) { if (ret < 0) {
dev_err(&urb->dev->dev, dev_err(dev->class_dev,
"comedi_: ao urb resubm failed in int-cont. " "ao urb resubm failed in int-cont. ret=%d",
"ret=%d", ret); ret);
if (ret == EL2NSYNC) if (ret == EL2NSYNC)
dev_err(&urb->dev->dev, dev_err(dev->class_dev,
"buggy USB host controller or bug in " "buggy USB host controller or bug in IRQ handling!\n");
"IRQ handling!\n");
s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_EOA;
s->async->events |= COMEDI_CB_ERROR; s->async->events |= COMEDI_CB_ERROR;
comedi_event(this_usbduxsub->comedidev, s); comedi_event(dev, s);
/* don't do an unlink here */ /* don't do an unlink here */
usbdux_ao_stop(this_usbduxsub, 0); usbdux_ao_stop(devpriv, 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