Skip to content

Commit

Permalink
staging: comedi: ni_labpc: fix labpc_calib_insn_read()
Browse files Browse the repository at this point in the history
The comedi core expects the (*insn_read) operations to read insn->n
values and return the number of values actually read.

Make this function work like the core expects.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Mar 26, 2013
1 parent 43d092c commit 198ac9d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/staging/comedi/drivers/ni_labpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1551,10 +1551,13 @@ static int labpc_calib_insn_read(struct comedi_device *dev,
unsigned int *data)
{
struct labpc_private *devpriv = dev->private;
unsigned int chan = CR_CHAN(insn->chanspec);
int i;

data[0] = devpriv->caldac[CR_CHAN(insn->chanspec)];
for (i = 0; i < insn->n; i++)
data[i] = devpriv->caldac[chan];

return 1;
return insn->n;
}

static int labpc_eeprom_insn_write(struct comedi_device *dev,
Expand Down

0 comments on commit 198ac9d

Please sign in to comment.