From: H Hartley Sweeten Date: Thu, 13 Mar 2014 21:16:12 +0000 (-0700) Subject: staging: comedi: gsc_hpdi: tidy up dio_config_insn() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=b0360a989d4385132a4d6639a2c9df9a837ac86a;p=linux-beck.git 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 Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c index 7a07c1f764a1..ed24a7b07998 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;