OSDN Git Service

staging: comedi: pcl818: simplify the dma->size calculations
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 14 Jan 2015 17:05:11 +0000 (10:05 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 17 Jan 2015 22:32:55 +0000 (14:32 -0800)
commit296e3f1816dbdb5f1c3213386756e362263b17b5
tree3b89bbd562e90338bfbb00535f4d6f69b810abed
parentcf0438c9c3da2f243961561d1e3742519b2eeb3d
staging: comedi: pcl818: simplify the dma->size calculations

Currently this driver determines the number of DMA "runs" needed and the size
of the "last" DMA transfer in order to perform a command. As long as there are
more "runs" required, the dma->size is set to the buffer maxsize. On the last
"run" the buffer is set to the "last" size.

Refactor the driver to use the comedi core helpers to determine the DMA size
based on the buffer maxsize and the number of samples remaining in the command.

This allows removing the 'dma_runs_to_end' and 'last_dma_run' mamebers from
the private data. Also remove the 'ai_data_len' member which is set but never
used.

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/pcl818.c