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

staging: comedi: icp_multi: tidy up subdevice init

For aesthetics, add some whitespace to the subdevice initialization.

Remove the unnecessary initialization of the 'len_chanlist' for each
subdevice. That member is only used by subdevices that support async
commands.

Also, remove the initialzation of the dev->read_subdev. That member
is also only used for async command support.

Rename some of the subdevice functions to follow the normal format
used in comedi drivers.
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 afbd3c2b
...@@ -107,7 +107,7 @@ static int icp_multi_ai_eoc(struct comedi_device *dev, ...@@ -107,7 +107,7 @@ static int icp_multi_ai_eoc(struct comedi_device *dev,
return -EBUSY; return -EBUSY;
} }
static int icp_multi_insn_read_ai(struct comedi_device *dev, static int icp_multi_ai_insn_read(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
...@@ -196,7 +196,7 @@ static int icp_multi_ao_insn_write(struct comedi_device *dev, ...@@ -196,7 +196,7 @@ static int icp_multi_ao_insn_write(struct comedi_device *dev,
return insn->n; return insn->n;
} }
static int icp_multi_insn_bits_di(struct comedi_device *dev, static int icp_multi_di_insn_bits(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
...@@ -206,7 +206,7 @@ static int icp_multi_insn_bits_di(struct comedi_device *dev, ...@@ -206,7 +206,7 @@ static int icp_multi_insn_bits_di(struct comedi_device *dev,
return insn->n; return insn->n;
} }
static int icp_multi_insn_bits_do(struct comedi_device *dev, static int icp_multi_do_insn_bits(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
...@@ -270,22 +270,21 @@ static int icp_multi_auto_attach(struct comedi_device *dev, ...@@ -270,22 +270,21 @@ static int icp_multi_auto_attach(struct comedi_device *dev,
icp_multi_reset(dev); icp_multi_reset(dev);
/* Analog Input subdevice */
s = &dev->subdevices[0]; s = &dev->subdevices[0];
dev->read_subdev = s;
s->type = COMEDI_SUBD_AI; s->type = COMEDI_SUBD_AI;
s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND | SDF_DIFF; s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND | SDF_DIFF;
s->n_chan = 16; s->n_chan = 16;
s->maxdata = 0x0fff; s->maxdata = 0x0fff;
s->len_chanlist = 16;
s->range_table = &icp_multi_ranges; s->range_table = &icp_multi_ranges;
s->insn_read = icp_multi_insn_read_ai; s->insn_read = icp_multi_ai_insn_read;
/* Analog Output subdevice */
s = &dev->subdevices[1]; s = &dev->subdevices[1];
s->type = COMEDI_SUBD_AO; s->type = COMEDI_SUBD_AO;
s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON;
s->n_chan = 4; s->n_chan = 4;
s->maxdata = 0x0fff; s->maxdata = 0x0fff;
s->len_chanlist = 4;
s->range_table = &icp_multi_ranges; s->range_table = &icp_multi_ranges;
s->insn_write = icp_multi_ao_insn_write; s->insn_write = icp_multi_ao_insn_write;
...@@ -293,23 +292,23 @@ static int icp_multi_auto_attach(struct comedi_device *dev, ...@@ -293,23 +292,23 @@ static int icp_multi_auto_attach(struct comedi_device *dev,
if (ret) if (ret)
return ret; return ret;
/* Digital Input subdevice */
s = &dev->subdevices[2]; s = &dev->subdevices[2];
s->type = COMEDI_SUBD_DI; s->type = COMEDI_SUBD_DI;
s->subdev_flags = SDF_READABLE; s->subdev_flags = SDF_READABLE;
s->n_chan = 16; s->n_chan = 16;
s->maxdata = 1; s->maxdata = 1;
s->len_chanlist = 16;
s->range_table = &range_digital; s->range_table = &range_digital;
s->insn_bits = icp_multi_insn_bits_di; s->insn_bits = icp_multi_di_insn_bits;
/* Digital Output subdevice */
s = &dev->subdevices[3]; s = &dev->subdevices[3];
s->type = COMEDI_SUBD_DO; s->type = COMEDI_SUBD_DO;
s->subdev_flags = SDF_WRITABLE; s->subdev_flags = SDF_WRITABLE;
s->n_chan = 8; s->n_chan = 8;
s->maxdata = 1; s->maxdata = 1;
s->len_chanlist = 8;
s->range_table = &range_digital; s->range_table = &range_digital;
s->insn_bits = icp_multi_insn_bits_do; s->insn_bits = icp_multi_do_insn_bits;
return 0; return 0;
} }
......
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