From: H Hartley Sweeten Date: Fri, 22 Mar 2013 16:57:48 +0000 (-0700) Subject: staging: comedi: ni_labpc: fix labpc_eeprom_insn_read() X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=1330af4c7deedd0b6d1ba43734d7e4eb1a83a491;p=openwrt%2Fstaging%2Fblogic.git staging: comedi: ni_labpc: fix labpc_eeprom_insn_read() 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 Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index 234f85e0f2f2..0afcede602ec 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c @@ -1591,10 +1591,13 @@ static int labpc_eeprom_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->eeprom_data[CR_CHAN(insn->chanspec)]; + for (i = 0; i < insn->n; i++) + data[i] = devpriv->eeprom_data[chan]; - return 1; + return insn->n; } int labpc_common_attach(struct comedi_device *dev, unsigned long iobase,