staging: comedi: adl_pci9111: use local variables for the chan/range
authorH Hartley Sweeten <hartleys@visionengravers.com>
Tue, 11 Sep 2012 02:00:46 +0000 (19:00 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Sep 2012 03:05:56 +0000 (20:05 -0700)
Simplify the chan/range in pci9111_ai_insn_read() by using local
variables for hold the values and by just passing insn->chanspec
to the CR_* macros instead of using (&insn->chanspec)[0].

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/adl_pci9111.c

index 6d20e59c696488e280166e910ab46ed77d46974e..0103e44acd452ede9e190d896848b08f5ea1fa22 100644 (file)
@@ -855,16 +855,18 @@ static int pci9111_ai_insn_read(struct comedi_device *dev,
                                struct comedi_subdevice *s,
                                struct comedi_insn *insn, unsigned int *data)
 {
+       unsigned int chan = CR_CHAN(insn->chanspec);
+       unsigned int range = CR_RANGE(insn->chanspec);
        unsigned int maxdata = s->maxdata;
        unsigned int invert = (maxdata + 1) >> 1;
        unsigned int shift = (maxdata == 0xffff) ? 0 : 4;
        int timeout;
        int i;
 
-       pci9111_ai_channel_set(CR_CHAN((&insn->chanspec)[0]));
+       pci9111_ai_channel_set(chan);
 
-       if ((pci9111_ai_range_get()) != CR_RANGE((&insn->chanspec)[0]))
-               pci9111_ai_range_set(CR_RANGE((&insn->chanspec)[0]));
+       if ((pci9111_ai_range_get()) != range)
+               pci9111_ai_range_set(range);
 
        pci9111_fifo_reset();