Skip to content

Commit de88924

Browse files
bigguinessgregkh
authored andcommitted
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: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent aa96f6e commit de88924

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

drivers/staging/comedi/drivers/me4000.c

+3-13
Original file line numberDiff line numberDiff line change
@@ -1092,8 +1092,6 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
10921092
} else if ((tmp & ME4000_AI_STATUS_BIT_FF_DATA)
10931093
&& !(tmp & ME4000_AI_STATUS_BIT_HF_DATA)
10941094
&& (tmp & ME4000_AI_STATUS_BIT_EF_DATA)) {
1095-
s->async->events |= COMEDI_CB_BLOCK;
1096-
10971095
c = ME4000_AI_FIFO_COUNT / 2;
10981096
} else {
10991097
dev_err(dev->class_dev,
@@ -1119,7 +1117,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
11191117
lval = inl(dev->iobase + ME4000_AI_DATA_REG) & 0xFFFF;
11201118
lval ^= 0x8000;
11211119

1122-
if (!comedi_buf_put(s, lval)) {
1120+
if (!comedi_buf_write_samples(s, &lval, 1)) {
11231121
/*
11241122
* Buffer overflow, so stop conversion
11251123
* and disable all interrupts
@@ -1128,11 +1126,6 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
11281126
tmp &= ~(ME4000_AI_CTRL_BIT_HF_IRQ |
11291127
ME4000_AI_CTRL_BIT_SC_IRQ);
11301128
outl(tmp, dev->iobase + ME4000_AI_CTRL_REG);
1131-
1132-
s->async->events |= COMEDI_CB_OVERFLOW;
1133-
1134-
dev_err(dev->class_dev, "Buffer overflow\n");
1135-
11361129
break;
11371130
}
11381131
}
@@ -1146,7 +1139,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
11461139

11471140
if (inl(dev->iobase + ME4000_IRQ_STATUS_REG) &
11481141
ME4000_IRQ_STATUS_BIT_SC) {
1149-
s->async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOA;
1142+
s->async->events |= COMEDI_CB_EOA;
11501143

11511144
/*
11521145
* Acquisition is complete, so stop
@@ -1164,11 +1157,8 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
11641157
lval = inl(dev->iobase + ME4000_AI_DATA_REG) & 0xFFFF;
11651158
lval ^= 0x8000;
11661159

1167-
if (!comedi_buf_put(s, lval)) {
1168-
dev_err(dev->class_dev, "Buffer overflow\n");
1169-
s->async->events |= COMEDI_CB_OVERFLOW;
1160+
if (!comedi_buf_write_samples(s, &lval, 1))
11701161
break;
1171-
}
11721162
}
11731163

11741164
/* Work is done, so reset the interrupt */

0 commit comments

Comments
 (0)