Skip to content

Commit 76cb501

Browse files
bigguinessgregkh
authored andcommitted
staging: comedi: pcl812: use comedi_buf_write_samples()
For aesthetics, use comedi_buf_write_samples() to add the sample to the async buffer. The core will add the COMEDI_CB_BLOCK event when data is written to the async buffer. Remove the nnecessary event in the driver. Signed-off-by: H Hartley Sweeten <[email protected]> Reviewed-by: Ian Abbott <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 778d695 commit 76cb501

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/staging/comedi/drivers/pcl812.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -844,8 +844,6 @@ static bool pcl812_ai_next_chan(struct comedi_device *dev,
844844
struct pcl812_private *devpriv = dev->private;
845845
struct comedi_cmd *cmd = &s->async->cmd;
846846

847-
s->async->events |= COMEDI_CB_BLOCK;
848-
849847
s->async->cur_chan++;
850848
if (s->async->cur_chan >= cmd->chanlist_len) {
851849
s->async->cur_chan = 0;
@@ -868,14 +866,16 @@ static void pcl812_handle_eoc(struct comedi_device *dev,
868866
{
869867
struct comedi_cmd *cmd = &s->async->cmd;
870868
unsigned int next_chan;
869+
unsigned short val;
871870

872871
if (pcl812_ai_eoc(dev, s, NULL, 0)) {
873872
dev_dbg(dev->class_dev, "A/D cmd IRQ without DRDY!\n");
874873
s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
875874
return;
876875
}
877876

878-
comedi_buf_put(s, pcl812_ai_get_sample(dev, s));
877+
val = pcl812_ai_get_sample(dev, s);
878+
comedi_buf_write_samples(s, &val, 1);
879879

880880
/* Set up next channel. Added by abbotti 2010-01-20, but untested. */
881881
next_chan = s->async->cur_chan + 1;
@@ -893,9 +893,11 @@ static void transfer_from_dma_buf(struct comedi_device *dev,
893893
unsigned int bufptr, unsigned int len)
894894
{
895895
unsigned int i;
896+
unsigned short val;
896897

897898
for (i = len; i; i--) {
898-
comedi_buf_put(s, ptr[bufptr++]);
899+
val = ptr[bufptr++];
900+
comedi_buf_write_samples(s, &val, 1);
899901

900902
if (!pcl812_ai_next_chan(dev, s))
901903
break;

0 commit comments

Comments
 (0)