Commit 44b255f7 authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: das16: pass struct comedi_cmd by reference

Change `das16_suggest_transfer_size()` to take a pointer to the `struct
comedi_cmd` instead of passing it by value.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c8cad4c8
...@@ -558,7 +558,7 @@ static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -558,7 +558,7 @@ static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s,
/* utility function that suggests a dma transfer size in bytes */ /* utility function that suggests a dma transfer size in bytes */
static unsigned int das16_suggest_transfer_size(struct comedi_device *dev, static unsigned int das16_suggest_transfer_size(struct comedi_device *dev,
struct comedi_cmd cmd) const struct comedi_cmd *cmd)
{ {
unsigned int size; unsigned int size;
unsigned int freq; unsigned int freq;
...@@ -571,16 +571,16 @@ static unsigned int das16_suggest_transfer_size(struct comedi_device *dev, ...@@ -571,16 +571,16 @@ static unsigned int das16_suggest_transfer_size(struct comedi_device *dev,
/* otherwise, we are relying on dma terminal count interrupt, /* otherwise, we are relying on dma terminal count interrupt,
* so pick a reasonable size */ * so pick a reasonable size */
if (cmd.convert_src == TRIG_TIMER) if (cmd->convert_src == TRIG_TIMER)
freq = 1000000000 / cmd.convert_arg; freq = 1000000000 / cmd->convert_arg;
else if (cmd.scan_begin_src == TRIG_TIMER) else if (cmd->scan_begin_src == TRIG_TIMER)
freq = (1000000000 / cmd.scan_begin_arg) * cmd.chanlist_len; freq = (1000000000 / cmd->scan_begin_arg) * cmd->chanlist_len;
/* return some default value */ /* return some default value */
else else
freq = 0xffffffff; freq = 0xffffffff;
if (cmd.flags & TRIG_WAKE_EOS) { if (cmd->flags & TRIG_WAKE_EOS) {
size = sample_size * cmd.chanlist_len; size = sample_size * cmd->chanlist_len;
} else { } else {
/* make buffer fill in no more than 1/3 second */ /* make buffer fill in no more than 1/3 second */
size = (freq / 3) * sample_size; size = (freq / 3) * sample_size;
...@@ -592,7 +592,7 @@ static unsigned int das16_suggest_transfer_size(struct comedi_device *dev, ...@@ -592,7 +592,7 @@ static unsigned int das16_suggest_transfer_size(struct comedi_device *dev,
else if (size < sample_size) else if (size < sample_size)
size = sample_size; size = sample_size;
if (cmd.stop_src == TRIG_COUNT && size > devpriv->adc_byte_count) if (cmd->stop_src == TRIG_COUNT && size > devpriv->adc_byte_count)
size = devpriv->adc_byte_count; size = devpriv->adc_byte_count;
return size; return size;
...@@ -685,7 +685,7 @@ static int das16_cmd_exec(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -685,7 +685,7 @@ static int das16_cmd_exec(struct comedi_device *dev, struct comedi_subdevice *s)
set_dma_addr(devpriv->dma_chan, set_dma_addr(devpriv->dma_chan,
devpriv->dma_buffer_addr[devpriv->current_buffer]); devpriv->dma_buffer_addr[devpriv->current_buffer]);
/* set appropriate size of transfer */ /* set appropriate size of transfer */
devpriv->dma_transfer_size = das16_suggest_transfer_size(dev, *cmd); devpriv->dma_transfer_size = das16_suggest_transfer_size(dev, cmd);
set_dma_count(devpriv->dma_chan, devpriv->dma_transfer_size); set_dma_count(devpriv->dma_chan, devpriv->dma_transfer_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