diff options
author | H Hartley Sweeten <hartleys@visionengravers.com> | 2014-03-13 21:16:12 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-03-17 21:19:48 (GMT) |
commit | b0360a989d4385132a4d6639a2c9df9a837ac86a (patch) | |
tree | 41bcc1bdc0be9eb0c8098332e9507129b0c4604a | |
parent | d987d372eb552862eba21b066978c7c6949b6fe8 (diff) | |
download | linux-b0360a989d4385132a4d6639a2c9df9a837ac86a.tar.xz |
staging: comedi: gsc_hpdi: tidy up dio_config_insn()
For aesthetics, rename this function so it has namespace associated
with the driver and move it so that it is not in the middle of the
async command support code.
Absorb the dio_config_block_size() helper function and remove 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>
-rw-r--r-- | drivers/staging/comedi/drivers/gsc_hpdi.c | 64 |
1 files changed, 26 insertions, 38 deletions
diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c index 7a07c1f..ed24a7b 100644 --- a/drivers/staging/comedi/drivers/gsc_hpdi.c +++ b/drivers/staging/comedi/drivers/gsc_hpdi.c @@ -53,7 +53,6 @@ #include "comedi_fc.h" static void abort_dma(struct comedi_device *dev, unsigned int channel); -static int dio_config_block_size(struct comedi_device *dev, unsigned int *data); #define TIMER_BASE 50 /* 20MHz master clock */ #define DMA_BUFFER_SIZE 0x10000 @@ -212,26 +211,6 @@ struct hpdi_private { volatile unsigned int block_size; }; -static int dio_config_insn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ - int ret; - - switch (data[0]) { - case INSN_CONFIG_BLOCK_SIZE: - return dio_config_block_size(dev, data); - default: - ret = comedi_dio_insn_config(dev, s, insn, data, 0xffffffff); - if (ret) - return ret; - break; - } - - return insn->n; -} - static void disable_plx_interrupts(struct comedi_device *dev) { struct hpdi_private *devpriv = dev->private; @@ -290,22 +269,6 @@ static int setup_dma_descriptors(struct comedi_device *dev, return transfer_size; } -static int dio_config_block_size(struct comedi_device *dev, unsigned int *data) -{ - unsigned int requested_block_size; - int retval; - - requested_block_size = data[1]; - - retval = setup_dma_descriptors(dev, requested_block_size); - if (retval < 0) - return retval; - - data[1] = retval; - - return 2; -} - static int di_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { @@ -595,6 +558,31 @@ static int hpdi_cancel(struct comedi_device *dev, struct comedi_subdevice *s) return 0; } +static int gsc_hpdi_dio_insn_config(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + int ret; + + switch (data[0]) { + case INSN_CONFIG_BLOCK_SIZE: + ret = setup_dma_descriptors(dev, data[1]); + if (ret) + return ret; + + data[1] = ret; + break; + default: + ret = comedi_dio_insn_config(dev, s, insn, data, 0xffffffff); + if (ret) + return ret; + break; + } + + return insn->n; +} + static int init_hpdi(struct comedi_device *dev) { struct hpdi_private *devpriv = dev->private; @@ -758,7 +746,7 @@ static int hpdi_auto_attach(struct comedi_device *dev, s->len_chanlist = 32; s->maxdata = 1; s->range_table = &range_digital; - s->insn_config = dio_config_insn; + s->insn_config = gsc_hpdi_dio_insn_config; s->do_cmd = hpdi_cmd; s->do_cmdtest = hpdi_cmd_test; s->cancel = hpdi_cancel; |