]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: comedi: pcl816: remove forward declaration
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Sat, 19 Jul 2014 00:01:20 +0000 (17:01 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Jul 2014 21:43:01 +0000 (14:43 -0700)
Move check_channel_list() to remove the need for the forward declaration.

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/pcl816.c

index 7cd54359af6476302346023b6b9c3d9ddecd02b1..54732c5cab97a88aa5796daf56709f1ce5b85709 100644 (file)
@@ -130,10 +130,6 @@ struct pcl816_private {
        unsigned int ai_cmd_canceled:1;
 };
 
-static int check_channel_list(struct comedi_device *dev,
-                             struct comedi_subdevice *s,
-                             unsigned int *chanlist, unsigned int chanlen);
-
 static void pcl816_start_pacer(struct comedi_device *dev, bool load_counters)
 {
        struct pcl816_private *devpriv = dev->private;
@@ -363,6 +359,62 @@ static irqreturn_t pcl816_interrupt(int irq, void *d)
        return IRQ_HANDLED;
 }
 
+static int check_channel_list(struct comedi_device *dev,
+                             struct comedi_subdevice *s,
+                             unsigned int *chanlist,
+                             unsigned int chanlen)
+{
+       unsigned int chansegment[16];
+       unsigned int i, nowmustbechan, seglen, segpos;
+
+       /*  correct channel and range number check itself comedi/range.c */
+       if (chanlen < 1) {
+               dev_err(dev->class_dev, "range/channel list is empty!\n");
+               return 0;
+       }
+
+       if (chanlen > 1) {
+               /*  first channel is every time ok */
+               chansegment[0] = chanlist[0];
+               for (i = 1, seglen = 1; i < chanlen; i++, seglen++) {
+                       /*  we detect loop, this must by finish */
+                           if (chanlist[0] == chanlist[i])
+                               break;
+                       nowmustbechan =
+                           (CR_CHAN(chansegment[i - 1]) + 1) % chanlen;
+                       if (nowmustbechan != CR_CHAN(chanlist[i])) {
+                               /*  channel list isn't continuous :-( */
+                               dev_dbg(dev->class_dev,
+                                       "channel list must be continuous! chanlist[%i]=%d but must be %d or %d!\n",
+                                       i, CR_CHAN(chanlist[i]), nowmustbechan,
+                                       CR_CHAN(chanlist[0]));
+                               return 0;
+                       }
+                       /*  well, this is next correct channel in list */
+                       chansegment[i] = chanlist[i];
+               }
+
+               /*  check whole chanlist */
+               for (i = 0, segpos = 0; i < chanlen; i++) {
+                           if (chanlist[i] != chansegment[i % seglen]) {
+                               dev_dbg(dev->class_dev,
+                                       "bad channel or range number! chanlist[%i]=%d,%d,%d and not %d,%d,%d!\n",
+                                       i, CR_CHAN(chansegment[i]),
+                                       CR_RANGE(chansegment[i]),
+                                       CR_AREF(chansegment[i]),
+                                       CR_CHAN(chanlist[i % seglen]),
+                                       CR_RANGE(chanlist[i % seglen]),
+                                       CR_AREF(chansegment[i % seglen]));
+                               return 0;       /*  chan/gain list is strange */
+                       }
+               }
+       } else {
+               seglen = 1;
+       }
+
+       return seglen;  /*  we can serve this with MUX logic */
+}
+
 static int pcl816_ai_cmdtest(struct comedi_device *dev,
                             struct comedi_subdevice *s, struct comedi_cmd *cmd)
 {
@@ -542,62 +594,6 @@ static int pcl816_ai_cancel(struct comedi_device *dev,
        return 0;
 }
 
-static int
-check_channel_list(struct comedi_device *dev,
-                  struct comedi_subdevice *s, unsigned int *chanlist,
-                  unsigned int chanlen)
-{
-       unsigned int chansegment[16];
-       unsigned int i, nowmustbechan, seglen, segpos;
-
-       /*  correct channel and range number check itself comedi/range.c */
-       if (chanlen < 1) {
-               dev_err(dev->class_dev, "range/channel list is empty!\n");
-               return 0;
-       }
-
-       if (chanlen > 1) {
-               /*  first channel is every time ok */
-               chansegment[0] = chanlist[0];
-               for (i = 1, seglen = 1; i < chanlen; i++, seglen++) {
-                       /*  we detect loop, this must by finish */
-                           if (chanlist[0] == chanlist[i])
-                               break;
-                       nowmustbechan =
-                           (CR_CHAN(chansegment[i - 1]) + 1) % chanlen;
-                       if (nowmustbechan != CR_CHAN(chanlist[i])) {
-                               /*  channel list isn't continuous :-( */
-                               dev_dbg(dev->class_dev,
-                                       "channel list must be continuous! chanlist[%i]=%d but must be %d or %d!\n",
-                                       i, CR_CHAN(chanlist[i]), nowmustbechan,
-                                       CR_CHAN(chanlist[0]));
-                               return 0;
-                       }
-                       /*  well, this is next correct channel in list */
-                       chansegment[i] = chanlist[i];
-               }
-
-               /*  check whole chanlist */
-               for (i = 0, segpos = 0; i < chanlen; i++) {
-                           if (chanlist[i] != chansegment[i % seglen]) {
-                               dev_dbg(dev->class_dev,
-                                       "bad channel or range number! chanlist[%i]=%d,%d,%d and not %d,%d,%d!\n",
-                                       i, CR_CHAN(chansegment[i]),
-                                       CR_RANGE(chansegment[i]),
-                                       CR_AREF(chansegment[i]),
-                                       CR_CHAN(chanlist[i % seglen]),
-                                       CR_RANGE(chanlist[i % seglen]),
-                                       CR_AREF(chansegment[i % seglen]));
-                               return 0;       /*  chan/gain list is strange */
-                       }
-               }
-       } else {
-               seglen = 1;
-       }
-
-       return seglen;  /*  we can serve this with MUX logic */
-}
-
 static int pcl816_ai_insn_read(struct comedi_device *dev,
                               struct comedi_subdevice *s,
                               struct comedi_insn *insn,