]> git.baikalelectronics.ru Git - kernel.git/commit
staging: comedi: das16: introduce das16_ao_range()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 26 Jan 2015 23:17:17 +0000 (16:17 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Jan 2015 19:14:04 +0000 (11:14 -0800)
commiteb3353077233a3257f5d5b1436584fdd9b8c36b4
treef4fdd00b3f7e6a8233476292a2cf00a1ee36888f
parent3994d17f90a1514667066545eb9ed6727a63faa5
staging: comedi: das16: introduce das16_ao_range()

Clarify the (*attach) a bit by introducing a helper function to handle the
setup of the analog output 'range_table'.

Some of the boards supported by this driver do not have programmable ranges.
The analog output subdevice can use optional range information provided by
the user during the attach of the driver. Currently this range data is
allocated and stored in the private data.

Use the subdevice private data member instead and allocate the memory with
comedi_alloc_spriv(). The comedi core will automatically free this memory
when the driver is detached. If the allocation fails set the 'range_table'
to 'range_unknown' instead of failing the driver attach.

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>
drivers/staging/comedi/drivers/das16.c