staging: comedi: amplc_pci230: sample types are unsigned
authorIan Abbott <abbotti@mev.co.uk>
Wed, 16 Oct 2013 13:40:13 +0000 (14:40 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Oct 2013 19:48:18 +0000 (12:48 -0700)
Sample values in comedi are generally represented as unsigned values.
Replace all uses of `short` to handle sample values in the
"amplc_pci230" driver with `unsigned short` for consistency.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/amplc_pci230.c

index 43059c25d5ea1ac8f89d1b0dbe30d35126a7dc36..a97bbd6ca3db5a5a3b6945c5157c25082ac62165 100644 (file)
@@ -573,14 +573,14 @@ static const struct comedi_lrange pci230_ao_range = { 2, {
 /* PCI230 daccon bipolar flag for each analogue output range. */
 static const unsigned char pci230_ao_bipolar[2] = { 0, 1 };
 
-static short pci230_ai_read(struct comedi_device *dev)
+static unsigned short pci230_ai_read(struct comedi_device *dev)
 {
        const struct pci230_board *thisboard = comedi_board(dev);
        struct pci230_private *devpriv = dev->private;
-       short data;
+       unsigned short data;
 
        /* Read sample. */
-       data = (short)inw(dev->iobase + PCI230_ADCDATA);
+       data = inw(dev->iobase + PCI230_ADCDATA);
        /* PCI230 is 12 bit - stored in upper bits of 16 bit register (lower
         * four bits reserved for expansion). */
        /* PCI230+ is 16 bit AI. */
@@ -595,7 +595,7 @@ static short pci230_ai_read(struct comedi_device *dev)
 }
 
 static inline unsigned short pci230_ao_mangle_datum(struct comedi_device *dev,
-                                                   short datum)
+                                                   unsigned short datum)
 {
        const struct pci230_board *thisboard = comedi_board(dev);
        struct pci230_private *devpriv = dev->private;
@@ -609,11 +609,12 @@ static inline unsigned short pci230_ao_mangle_datum(struct comedi_device *dev,
         * four bits reserved for expansion). */
        /* PCI230+ is also 12 bit AO. */
        datum <<= (16 - thisboard->ao_bits);
-       return (unsigned short)datum;
+       return datum;
 }
 
 static inline void pci230_ao_write_nofifo(struct comedi_device *dev,
-                                         short datum, unsigned int chan)
+                                         unsigned short datum,
+                                         unsigned int chan)
 {
        struct pci230_private *devpriv = dev->private;
 
@@ -627,8 +628,8 @@ static inline void pci230_ao_write_nofifo(struct comedi_device *dev,
                                                                PCI230_DACOUT2));
 }
 
-static inline void pci230_ao_write_fifo(struct comedi_device *dev, short datum,
-                                       unsigned int chan)
+static inline void pci230_ao_write_fifo(struct comedi_device *dev,
+                                       unsigned short datum, unsigned int chan)
 {
        struct pci230_private *devpriv = dev->private;
 
@@ -1165,7 +1166,7 @@ static void pci230_handle_ao_nofifo(struct comedi_device *dev,
                                    struct comedi_subdevice *s)
 {
        struct pci230_private *devpriv = dev->private;
-       short data;
+       unsigned short data;
        int i, ret;
        struct comedi_async *async = s->async;
        struct comedi_cmd *cmd = &async->cmd;
@@ -1258,7 +1259,7 @@ static int pci230_handle_ao_fifo(struct comedi_device *dev,
                /* Process scans. */
                for (n = 0; n < num_scans; n++) {
                        for (i = 0; i < cmd->chanlist_len; i++) {
-                               short datum;
+                               unsigned short datum;
 
                                comedi_buf_get(async, &datum);
                                pci230_ao_write_fifo(dev, datum,