[PATCH 1/4] staging: comedi: core: introduce comedi_dio_insn_config()

Ian Abbott abbotti at mev.co.uk
Tue Aug 6 14:16:03 UTC 2013


On 2013-08-05 23:00, H Hartley Sweeten wrote:
> 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 parameters 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 at visionengravers.com>
> Cc: Ian Abbott <abbotti at mev.co.uk>
> Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>

Reviewed-by: Ian Abbott <abbotti at mev.co.uk>

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-


More information about the devel mailing list