提交 fd27ae76 编写于 作者: H H Hartley Sweeten 提交者: Greg Kroah-Hartman

staging: comedi: pcl812: fix logic error in pcl812_ai_setup_dma()

commit 92afc2b2 inroduced a logic error
in the DMA size calculation.

If the 'nsamples' is greater than the 'unread_samples' then DMA needs to
be restarted. The current code checks it agains the 'max_samples'.
Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: NIan Abbott <abbotti@mev.co.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 119c9643
...@@ -559,8 +559,8 @@ static void pcl812_ai_setup_dma(struct comedi_device *dev, ...@@ -559,8 +559,8 @@ static void pcl812_ai_setup_dma(struct comedi_device *dev,
* unread samples and the number of samples remaining in the command. * unread samples and the number of samples remaining in the command.
*/ */
nsamples = comedi_nsamples_left(s, max_samples + unread_samples); nsamples = comedi_nsamples_left(s, max_samples + unread_samples);
if (nsamples > max_samples) { if (nsamples > unread_samples) {
nsamples -= max_samples; nsamples -= unread_samples;
desc->size = comedi_samples_to_bytes(s, nsamples); desc->size = comedi_samples_to_bytes(s, nsamples);
comedi_isadma_program(desc); comedi_isadma_program(desc);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册