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

staging: comedi: me4000: use comedi_buf_write_samples()

Use comedi_buf_write_samples() to add the sample to the async buffer.

The async events COMEDI_CB_OVERFLOW will be set by the core if the async
buffer overflows. A dev_warn() message will also be output by the core
if the buffer overflows. Remove the unnecessary event and the dev_err()
messages in the driver.

The core will also add the COMEDI_CB_BLOCK event when data is written
to the async buffer. Remove these unnecessary events from the driver.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent aa96f6ef
...@@ -1092,8 +1092,6 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) ...@@ -1092,8 +1092,6 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
} else if ((tmp & ME4000_AI_STATUS_BIT_FF_DATA) } else if ((tmp & ME4000_AI_STATUS_BIT_FF_DATA)
&& !(tmp & ME4000_AI_STATUS_BIT_HF_DATA) && !(tmp & ME4000_AI_STATUS_BIT_HF_DATA)
&& (tmp & ME4000_AI_STATUS_BIT_EF_DATA)) { && (tmp & ME4000_AI_STATUS_BIT_EF_DATA)) {
s->async->events |= COMEDI_CB_BLOCK;
c = ME4000_AI_FIFO_COUNT / 2; c = ME4000_AI_FIFO_COUNT / 2;
} else { } else {
dev_err(dev->class_dev, dev_err(dev->class_dev,
...@@ -1119,7 +1117,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) ...@@ -1119,7 +1117,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
lval = inl(dev->iobase + ME4000_AI_DATA_REG) & 0xFFFF; lval = inl(dev->iobase + ME4000_AI_DATA_REG) & 0xFFFF;
lval ^= 0x8000; lval ^= 0x8000;
if (!comedi_buf_put(s, lval)) { if (!comedi_buf_write_samples(s, &lval, 1)) {
/* /*
* Buffer overflow, so stop conversion * Buffer overflow, so stop conversion
* and disable all interrupts * and disable all interrupts
...@@ -1128,11 +1126,6 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) ...@@ -1128,11 +1126,6 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
tmp &= ~(ME4000_AI_CTRL_BIT_HF_IRQ | tmp &= ~(ME4000_AI_CTRL_BIT_HF_IRQ |
ME4000_AI_CTRL_BIT_SC_IRQ); ME4000_AI_CTRL_BIT_SC_IRQ);
outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); outl(tmp, dev->iobase + ME4000_AI_CTRL_REG);
s->async->events |= COMEDI_CB_OVERFLOW;
dev_err(dev->class_dev, "Buffer overflow\n");
break; break;
} }
} }
...@@ -1146,7 +1139,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) ...@@ -1146,7 +1139,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
if (inl(dev->iobase + ME4000_IRQ_STATUS_REG) & if (inl(dev->iobase + ME4000_IRQ_STATUS_REG) &
ME4000_IRQ_STATUS_BIT_SC) { ME4000_IRQ_STATUS_BIT_SC) {
s->async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOA; s->async->events |= COMEDI_CB_EOA;
/* /*
* Acquisition is complete, so stop * Acquisition is complete, so stop
...@@ -1164,12 +1157,9 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) ...@@ -1164,12 +1157,9 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
lval = inl(dev->iobase + ME4000_AI_DATA_REG) & 0xFFFF; lval = inl(dev->iobase + ME4000_AI_DATA_REG) & 0xFFFF;
lval ^= 0x8000; lval ^= 0x8000;
if (!comedi_buf_put(s, lval)) { if (!comedi_buf_write_samples(s, &lval, 1))
dev_err(dev->class_dev, "Buffer overflow\n");
s->async->events |= COMEDI_CB_OVERFLOW;
break; break;
} }
}
/* Work is done, so reset the interrupt */ /* Work is done, so reset the interrupt */
tmp |= ME4000_AI_CTRL_BIT_SC_IRQ_RESET; tmp |= ME4000_AI_CTRL_BIT_SC_IRQ_RESET;
......
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