Commit 59e561f3 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: das16: move dma transfer 'size' to dma descriptor

For asethetics, move the variable that holds the dma transfer 'size' into
the dma descriptor.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ae4e131e
...@@ -441,6 +441,7 @@ static inline int timer_period(void) ...@@ -441,6 +441,7 @@ static inline int timer_period(void)
struct das16_dma_desc { struct das16_dma_desc {
uint16_t *virt_addr; /* virtual address of DMA buffer */ uint16_t *virt_addr; /* virtual address of DMA buffer */
dma_addr_t hw_addr; /* hardware (bus) address of DMA buffer */ dma_addr_t hw_addr; /* hardware (bus) address of DMA buffer */
unsigned int size; /* transfer size (in bytes) */
}; };
struct das16_private_struct { struct das16_private_struct {
...@@ -452,7 +453,6 @@ struct das16_private_struct { ...@@ -452,7 +453,6 @@ struct das16_private_struct {
unsigned int dma_chan; unsigned int dma_chan;
struct das16_dma_desc dma_desc[2]; struct das16_dma_desc dma_desc[2];
unsigned int cur_dma; unsigned int cur_dma;
unsigned int dma_transfer_size;
struct comedi_lrange *user_ai_range_table; struct comedi_lrange *user_ai_range_table;
struct comedi_lrange *user_ao_range_table; struct comedi_lrange *user_ao_range_table;
struct timer_list timer; struct timer_list timer;
...@@ -549,12 +549,12 @@ static void das16_interrupt(struct comedi_device *dev) ...@@ -549,12 +549,12 @@ static void das16_interrupt(struct comedi_device *dev)
residue = disable_dma_on_even(dev); residue = disable_dma_on_even(dev);
/* figure out how many points to read */ /* figure out how many points to read */
if (residue > devpriv->dma_transfer_size) { if (residue > dma->size) {
dev_err(dev->class_dev, "residue > transfer size!\n"); dev_err(dev->class_dev, "residue > transfer size!\n");
async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
num_bytes = 0; num_bytes = 0;
} else } else
num_bytes = devpriv->dma_transfer_size - residue; num_bytes = dma->size - residue;
if (cmd->stop_src == TRIG_COUNT && if (cmd->stop_src == TRIG_COUNT &&
num_bytes >= devpriv->adc_byte_count) { num_bytes >= devpriv->adc_byte_count) {
...@@ -569,7 +569,8 @@ static void das16_interrupt(struct comedi_device *dev) ...@@ -569,7 +569,8 @@ static void das16_interrupt(struct comedi_device *dev)
if ((async->events & COMEDI_CB_EOA) == 0) { if ((async->events & COMEDI_CB_EOA) == 0) {
nxt_dma = &devpriv->dma_desc[devpriv->cur_dma]; nxt_dma = &devpriv->dma_desc[devpriv->cur_dma];
set_dma_addr(devpriv->dma_chan, nxt_dma->hw_addr); set_dma_addr(devpriv->dma_chan, nxt_dma->hw_addr);
set_dma_count(devpriv->dma_chan, devpriv->dma_transfer_size); nxt_dma->size = DAS16_DMA_SIZE;
set_dma_count(devpriv->dma_chan, nxt_dma->size);
enable_dma(devpriv->dma_chan); enable_dma(devpriv->dma_chan);
} }
release_dma_lock(dma_flags); release_dma_lock(dma_flags);
...@@ -805,8 +806,8 @@ static int das16_cmd_exec(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -805,8 +806,8 @@ static int das16_cmd_exec(struct comedi_device *dev, struct comedi_subdevice *s)
clear_dma_ff(devpriv->dma_chan); clear_dma_ff(devpriv->dma_chan);
devpriv->cur_dma = 0; devpriv->cur_dma = 0;
set_dma_addr(devpriv->dma_chan, dma->hw_addr); set_dma_addr(devpriv->dma_chan, dma->hw_addr);
devpriv->dma_transfer_size = DAS16_DMA_SIZE; dma->size = DAS16_DMA_SIZE;
set_dma_count(devpriv->dma_chan, devpriv->dma_transfer_size); set_dma_count(devpriv->dma_chan, dma->size);
enable_dma(devpriv->dma_chan); enable_dma(devpriv->dma_chan);
release_dma_lock(flags); release_dma_lock(flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment