Skip to content

Commit 987f3c8

Browse files
committed
Revert "staging: comedi: skel: use comedi_dio_insn_config()"
This reverts commit 42ef678. It's incorrect as well... time for more coffee... Cc: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 99ac7cc commit 987f3c8

File tree

1 file changed

+23
-19
lines changed
  • drivers/staging/comedi/drivers

1 file changed

+23
-19
lines changed

drivers/staging/comedi/drivers/skel.c

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -362,27 +362,31 @@ static int skel_dio_insn_bits(struct comedi_device *dev,
362362

363363
static int skel_dio_insn_config(struct comedi_device *dev,
364364
struct comedi_subdevice *s,
365-
struct comedi_insn *insn,
366-
unsigned int *data)
365+
struct comedi_insn *insn, unsigned int *data)
367366
{
368-
int ret;
369-
370-
/*
371-
* The input or output configuration of each digital line is
372-
* configured by special insn_config instructions.
373-
*
374-
* chanspec contains the channel to be changed
375-
* data[0] contains the instruction to perform on the channel
376-
*
377-
* Normally the core provided comedi_dio_insn_config() function
378-
* can be used to handle the boilerplpate.
379-
*/
380-
ret = comedi_dio_insn_config(dev, s, insn, data, 0);
381-
if (ret)
382-
return ret;
367+
int chan = CR_CHAN(insn->chanspec);
383368

384-
/* Update the hardware to the new configuration */
385-
/* outw(s->io_bits, dev->iobase + SKEL_DIO_CONFIG); */
369+
/* The input or output configuration of each digital line is
370+
* configured by a special insn_config instruction. chanspec
371+
* contains the channel to be changed, and data[0] contains the
372+
* value COMEDI_INPUT or COMEDI_OUTPUT. */
373+
switch (data[0]) {
374+
case INSN_CONFIG_DIO_OUTPUT:
375+
s->io_bits |= 1 << chan;
376+
break;
377+
case INSN_CONFIG_DIO_INPUT:
378+
s->io_bits &= ~(1 << chan);
379+
break;
380+
case INSN_CONFIG_DIO_QUERY:
381+
data[1] =
382+
(s->io_bits & (1 << chan)) ? COMEDI_OUTPUT : COMEDI_INPUT;
383+
return insn->n;
384+
break;
385+
default:
386+
return -EINVAL;
387+
break;
388+
}
389+
/* outw(s->io_bits,dev->iobase + SKEL_DIO_CONFIG); */
386390

387391
return insn->n;
388392
}

0 commit comments

Comments
 (0)