From: H Hartley Sweeten Date: Sat, 19 Jul 2014 00:01:18 +0000 (-0700) Subject: staging: comedi: ni_pcidio: remove forward declarations X-Git-Tag: v3.17-rc1~123^2~379 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=5d6e2298b29113e6b71f1c30bfcfc70051abdcec;p=karo-tx-linux.git staging: comedi: ni_pcidio: remove forward declarations Move some of the functions to remove the need for the forward declarations. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index cb161d815444..0a24b216c226 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c @@ -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) {