Commit b0360a98 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d987d372
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment