Skip to content

Commit 62100fe

Browse files
bigguinessgregkh
authored andcommitted
staging: comedi: quatech_daqp_cs: use (*insn_bits) for digital inputs
Change the subdevice operation used to read the digital inputs from a (*insn_read) to a (*insn_bits) function. The (*insn_read) functions are expected to read 'insn->n' number of samples. The (*insn_bits) functions just read a single sample (insn->n = 1). Change the return from '1' to 'insn->n' to clarify what the return is. Also, set the 'maxdata' for the subdevice. For digital io this value should be '1' (digital io can only be 1 or 0). Signed-off-by: H Hartley Sweeten <[email protected]> Cc: Ian Abbott <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 491cc0b commit 62100fe

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/staging/comedi/drivers/quatech_daqp_cs.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -671,11 +671,10 @@ static int daqp_ao_insn_write(struct comedi_device *dev,
671671
return 1;
672672
}
673673

674-
/* Digital input routine */
675-
676-
static int daqp_di_insn_read(struct comedi_device *dev,
674+
static int daqp_di_insn_bits(struct comedi_device *dev,
677675
struct comedi_subdevice *s,
678-
struct comedi_insn *insn, unsigned int *data)
676+
struct comedi_insn *insn,
677+
unsigned int *data)
679678
{
680679
struct daqp_private *devpriv = dev->private;
681680

@@ -684,7 +683,7 @@ static int daqp_di_insn_read(struct comedi_device *dev,
684683

685684
data[0] = inb(dev->iobase + DAQP_DIGITAL_IO);
686685

687-
return 1;
686+
return insn->n;
688687
}
689688

690689
/* Digital output routine */
@@ -758,7 +757,8 @@ static int daqp_auto_attach(struct comedi_device *dev,
758757
s->type = COMEDI_SUBD_DI;
759758
s->subdev_flags = SDF_READABLE;
760759
s->n_chan = 1;
761-
s->insn_read = daqp_di_insn_read;
760+
s->maxdata = 1;
761+
s->insn_bits = daqp_di_insn_bits;
762762

763763
s = &dev->subdevices[3];
764764
s->type = COMEDI_SUBD_DO;

0 commit comments

Comments
 (0)