diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2015-01-13 17:16:37 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-01-17 22:31:31 (GMT) |
commit | ac525a7f724ef47cae087fc2b09978a5fdda829c (patch) | |
tree | 9a9a6a39ed3074ede49108144291e9802ba7b0f7 | |
parent | 10f3a2dca81ace26daacf26c5d79c5876576e7ea (diff) | |
download | linux-ac525a7f724ef47cae087fc2b09978a5fdda829c.tar.xz |
staging: comedi: ni_labpc_isadma: remove hard coded samples size
Use the comedi_bytes_per_sample() helper and remove the hard coded sample
size.
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>
-rw-r--r-- | drivers/staging/comedi/drivers/ni_labpc_isadma.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/staging/comedi/drivers/ni_labpc_isadma.c b/drivers/staging/comedi/drivers/ni_labpc_isadma.c index ecdbe11..43e4f99 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_isadma.c +++ b/drivers/staging/comedi/drivers/ni_labpc_isadma.c @@ -30,12 +30,13 @@ /* size in bytes of dma buffer */ static const int dma_buffer_size = 0xff00; -/* 2 bytes per sample */ -static const int sample_size = 2; /* utility function that suggests a dma transfer size in bytes */ -static unsigned int labpc_suggest_transfer_size(const struct comedi_cmd *cmd) +static unsigned int labpc_suggest_transfer_size(struct comedi_device *dev, + struct comedi_subdevice *s) { + struct comedi_cmd *cmd = &s->async->cmd; + unsigned int sample_size = comedi_bytes_per_sample(s); unsigned int size; unsigned int freq; @@ -62,6 +63,7 @@ void labpc_setup_dma(struct comedi_device *dev, struct comedi_subdevice *s) struct labpc_private *devpriv = dev->private; struct labpc_dma_desc *dma = &devpriv->dma_desc; struct comedi_cmd *cmd = &s->async->cmd; + unsigned int sample_size = comedi_bytes_per_sample(s); unsigned long irq_flags; irq_flags = claim_dma_lock(); @@ -71,7 +73,7 @@ void labpc_setup_dma(struct comedi_device *dev, struct comedi_subdevice *s) clear_dma_ff(dma->chan); set_dma_addr(dma->chan, dma->hw_addr); /* set appropriate size of transfer */ - dma->size = labpc_suggest_transfer_size(cmd); + dma->size = labpc_suggest_transfer_size(dev, s); if (cmd->stop_src == TRIG_COUNT && devpriv->count * sample_size < dma->size) dma->size = devpriv->count * sample_size; @@ -90,6 +92,7 @@ void labpc_drain_dma(struct comedi_device *dev) struct comedi_subdevice *s = dev->read_subdev; struct comedi_async *async = s->async; struct comedi_cmd *cmd = &async->cmd; + unsigned int sample_size = comedi_bytes_per_sample(s); int status; unsigned long flags; unsigned int max_points, num_points, residue, leftover; |