staging: comedi: adl_pci9118: use sample manipulation helpers
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Fri, 31 Oct 2014 19:04:33 +0000 (12:04 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 4 Nov 2014 00:34:18 +0000 (16:34 -0800)
Use the recently added sample manipulation helpers to remove the hardcoded
assumption of the 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>
drivers/staging/comedi/drivers/adl_pci9118.c

index 93b41e6712a6cbc369a13111a43d6aa19182ca71..2aef881b6ee41965453c110d0fd1f6aee44c3935 100644 (file)
@@ -586,8 +586,9 @@ static void pci9118_ai_munge(struct comedi_device *dev,
                             unsigned int start_chan_index)
 {
        struct pci9118_private *devpriv = dev->private;
-       unsigned int i, num_samples = num_bytes / sizeof(short);
        unsigned short *array = data;
+       unsigned int num_samples = comedi_bytes_to_samples(s, num_bytes);
+       unsigned int i;
 
        for (i = 0; i < num_samples; i++) {
                if (devpriv->usedma)