mirror of https://gitee.com/openkylin/linux.git
staging: comedi: skel: use comedi_dio_insn_config()
Convert this driver to use the comedi_dio_insn_config() helper function. Tidy up the comments to reflect the new code. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
4f76463d3b
commit
42ef678bef
|
@ -362,31 +362,27 @@ static int skel_dio_insn_bits(struct comedi_device *dev,
|
||||||
|
|
||||||
static int skel_dio_insn_config(struct comedi_device *dev,
|
static int skel_dio_insn_config(struct comedi_device *dev,
|
||||||
struct comedi_subdevice *s,
|
struct comedi_subdevice *s,
|
||||||
struct comedi_insn *insn, unsigned int *data)
|
struct comedi_insn *insn,
|
||||||
|
unsigned int *data)
|
||||||
{
|
{
|
||||||
int chan = CR_CHAN(insn->chanspec);
|
int ret;
|
||||||
|
|
||||||
/* The input or output configuration of each digital line is
|
/*
|
||||||
* configured by a special insn_config instruction. chanspec
|
* The input or output configuration of each digital line is
|
||||||
* contains the channel to be changed, and data[0] contains the
|
* configured by special insn_config instructions.
|
||||||
* value COMEDI_INPUT or COMEDI_OUTPUT. */
|
*
|
||||||
switch (data[0]) {
|
* chanspec contains the channel to be changed
|
||||||
case INSN_CONFIG_DIO_OUTPUT:
|
* data[0] contains the instruction to perform on the channel
|
||||||
s->io_bits |= 1 << chan;
|
*
|
||||||
break;
|
* Normally the core provided comedi_dio_insn_config() function
|
||||||
case INSN_CONFIG_DIO_INPUT:
|
* can be used to handle the boilerplpate.
|
||||||
s->io_bits &= ~(1 << chan);
|
*/
|
||||||
break;
|
ret = comedi_dio_insn_config(dev, s, insn, data, 0);
|
||||||
case INSN_CONFIG_DIO_QUERY:
|
if (ret)
|
||||||
data[1] =
|
return ret;
|
||||||
(s->io_bits & (1 << chan)) ? COMEDI_OUTPUT : COMEDI_INPUT;
|
|
||||||
return insn->n;
|
/* Update the hardware to the new configuration */
|
||||||
break;
|
/* outw(s->io_bits, dev->iobase + SKEL_DIO_CONFIG); */
|
||||||
default:
|
|
||||||
return -EINVAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* outw(s->io_bits,dev->iobase + SKEL_DIO_CONFIG); */
|
|
||||||
|
|
||||||
return insn->n;
|
return insn->n;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue