diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2013-08-06 09:31:35 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-12 15:17:45 -0700 |
commit | e523c6c86232eb5564662aa17199c676d127bc5e (patch) | |
tree | 72644f8fbdb5fcf7eb4970ae7cb16fbc86d8c6c2 /drivers/staging/comedi/comedidev.h | |
parent | 987f3c86a14a67d16bcc648d062bfa46cbd2e552 (diff) |
staging: comedi: drivers: introduce comedi_dio_insn_config()
DIO subdevices always handle the INSN_CONFIG_DIO_{INPUT,OUTPUT} instructions
to configure the DIO channels. They also always handle the INSN_CONFIG_DIO_QUERY
instruction to query the configuration of a DIO channel.
Introduce a helper function to handle the (*insn_config) boilerplate for
comedi DIO subdevices. This function has the same paramters as (*insn_config)
functions with an additional parameter to allow the caller to pass a 'mask'
value for grouped DIO channels.
This function returns:
0 if the instruction was successful but requires additional handling by
the caller (INSN_CONFIG_DIO_{INPUT,OUTPUT}
insn->n if the instruction was handled (INSN_CONFIG_DIO_QUERY)
-EINVAL for all unhandled instructions
The caller is responsible for actually configuring the hardware based on
the configuration (s->io_bits).
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/comedidev.h')
-rw-r--r-- | drivers/staging/comedi/comedidev.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 98058b9097e..f2f75b9dfb8 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -342,6 +342,10 @@ void comedi_buf_memcpy_from(struct comedi_async *async, unsigned int offset, /* drivers.c - general comedi driver functions */ +int comedi_dio_insn_config(struct comedi_device *, struct comedi_subdevice *, + struct comedi_insn *, unsigned int *data, + unsigned int mask); + void *comedi_alloc_devpriv(struct comedi_device *, size_t); int comedi_alloc_subdevices(struct comedi_device *, int); |