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

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

index cb161d8154443ae3d983c24c3d4f3a5fc33510f5..0a24b216c226d53bf7cc7d69814c010abc7e3a4c 100644 (file)
@@ -297,16 +297,6 @@ struct nidio96_private {
        spinlock_t mite_channel_lock;
 };
 
-static int ni_pcidio_cmdtest(struct comedi_device *dev,
-                            struct comedi_subdevice *s,
-                            struct comedi_cmd *cmd);
-static int ni_pcidio_cmd(struct comedi_device *dev, struct comedi_subdevice *s);
-static int ni_pcidio_inttrig(struct comedi_device *dev,
-                            struct comedi_subdevice *s, unsigned int trignum);
-static int ni_pcidio_ns_to_timer(int *nanosec, unsigned int flags);
-static int setup_mite_dma(struct comedi_device *dev,
-                         struct comedi_subdevice *s);
-
 static int ni_pcidio_request_di_mite_channel(struct comedi_device *dev)
 {
        struct nidio96_private *devpriv = dev->private;
@@ -350,6 +340,30 @@ static void ni_pcidio_release_di_mite_channel(struct comedi_device *dev)
        spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
 }
 
+static int setup_mite_dma(struct comedi_device *dev, struct comedi_subdevice *s)
+{
+       struct nidio96_private *devpriv = dev->private;
+       int retval;
+       unsigned long flags;
+
+       retval = ni_pcidio_request_di_mite_channel(dev);
+       if (retval)
+               return retval;
+
+       /* write alloc the entire buffer */
+       comedi_buf_write_alloc(s, s->async->prealloc_bufsz);
+
+       spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
+       if (devpriv->di_mite_chan) {
+               mite_prep_dma(devpriv->di_mite_chan, 32, 32);
+               mite_dma_arm(devpriv->di_mite_chan);
+       } else
+               retval = -EIO;
+       spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
+
+       return retval;
+}
+
 static int ni_pcidio_poll(struct comedi_device *dev, struct comedi_subdevice *s)
 {
        struct nidio96_private *devpriv = dev->private;
@@ -532,6 +546,29 @@ static int ni_pcidio_insn_bits(struct comedi_device *dev,
        return insn->n;
 }
 
+static int ni_pcidio_ns_to_timer(int *nanosec, unsigned int flags)
+{
+       int divider, base;
+
+       base = TIMER_BASE;
+
+       switch (flags & TRIG_ROUND_MASK) {
+       case TRIG_ROUND_NEAREST:
+       default:
+               divider = (*nanosec + base / 2) / base;
+               break;
+       case TRIG_ROUND_DOWN:
+               divider = (*nanosec) / base;
+               break;
+       case TRIG_ROUND_UP:
+               divider = (*nanosec + base - 1) / base;
+               break;
+       }
+
+       *nanosec = base * divider;
+       return divider;
+}
+
 static int ni_pcidio_cmdtest(struct comedi_device *dev,
                             struct comedi_subdevice *s, struct comedi_cmd *cmd)
 {
@@ -606,27 +643,20 @@ static int ni_pcidio_cmdtest(struct comedi_device *dev,
        return 0;
 }
 
-static int ni_pcidio_ns_to_timer(int *nanosec, unsigned int flags)
+static int ni_pcidio_inttrig(struct comedi_device *dev,
+                            struct comedi_subdevice *s,
+                            unsigned int trig_num)
 {
-       int divider, base;
+       struct nidio96_private *devpriv = dev->private;
+       struct comedi_cmd *cmd = &s->async->cmd;
 
-       base = TIMER_BASE;
+       if (trig_num != cmd->start_arg)
+               return -EINVAL;
 
-       switch (flags & TRIG_ROUND_MASK) {
-       case TRIG_ROUND_NEAREST:
-       default:
-               divider = (*nanosec + base / 2) / base;
-               break;
-       case TRIG_ROUND_DOWN:
-               divider = (*nanosec) / base;
-               break;
-       case TRIG_ROUND_UP:
-               divider = (*nanosec + base - 1) / base;
-               break;
-       }
+       writeb(devpriv->OpModeBits, devpriv->mite->daq_io_addr + OpMode);
+       s->async->inttrig = NULL;
 
-       *nanosec = base * divider;
-       return divider;
+       return 1;
 }
 
 static int ni_pcidio_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
@@ -747,46 +777,6 @@ static int ni_pcidio_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
        return 0;
 }
 
-static int setup_mite_dma(struct comedi_device *dev, struct comedi_subdevice *s)
-{
-       struct nidio96_private *devpriv = dev->private;
-       int retval;
-       unsigned long flags;
-
-       retval = ni_pcidio_request_di_mite_channel(dev);
-       if (retval)
-               return retval;
-
-       /* write alloc the entire buffer */
-       comedi_buf_write_alloc(s, s->async->prealloc_bufsz);
-
-       spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
-       if (devpriv->di_mite_chan) {
-               mite_prep_dma(devpriv->di_mite_chan, 32, 32);
-               mite_dma_arm(devpriv->di_mite_chan);
-       } else
-               retval = -EIO;
-       spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
-
-       return retval;
-}
-
-static int ni_pcidio_inttrig(struct comedi_device *dev,
-                            struct comedi_subdevice *s,
-                            unsigned int trig_num)
-{
-       struct nidio96_private *devpriv = dev->private;
-       struct comedi_cmd *cmd = &s->async->cmd;
-
-       if (trig_num != cmd->start_arg)
-               return -EINVAL;
-
-       writeb(devpriv->OpModeBits, devpriv->mite->daq_io_addr + OpMode);
-       s->async->inttrig = NULL;
-
-       return 1;
-}
-
 static int ni_pcidio_cancel(struct comedi_device *dev,
                            struct comedi_subdevice *s)
 {