diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2015-10-14 00:48:01 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-17 06:20:10 (GMT) |
commit | 790b2f06249602ee2560bb94cce4b934abcba6e4 (patch) | |
tree | 30da2e37c248045a6b8d5b9dbc74370260c8dad8 /drivers | |
parent | c5c51b1d6a7629a3efd413fc9f6a6e5d553d5f24 (diff) | |
download | linux-790b2f06249602ee2560bb94cce4b934abcba6e4.tar.xz |
staging: comedi: cb_pcidas: tidy up analog input subdevice init
For aesthetics, add some whitespace to the subdevice initialization
and rename the subdevice functions to follow the normal form in
comedi drivers.
Async command support uses interrupts. For clarity, make sure the
driver has an IRQ before initializing command support.
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/comedi/drivers/cb_pcidas.c | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 4c192fc..268ec77 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -332,9 +332,10 @@ static int cb_pcidas_ai_eoc(struct comedi_device *dev, return -EBUSY; } -static int cb_pcidas_ai_rinsn(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int cb_pcidas_ai_insn_read(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { struct cb_pcidas_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -384,8 +385,10 @@ static int cb_pcidas_ai_rinsn(struct comedi_device *dev, return n; } -static int ai_config_insn(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int cb_pcidas_ai_insn_config(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { struct cb_pcidas_private *devpriv = dev->private; int id = data[0]; @@ -960,9 +963,8 @@ static int cb_pcidas_ao_cmdtest(struct comedi_device *dev, return 0; } -/* cancel analog input command */ -static int cb_pcidas_cancel(struct comedi_device *dev, - struct comedi_subdevice *s) +static int cb_pcidas_ai_cancel(struct comedi_device *dev, + struct comedi_subdevice *s) { struct cb_pcidas_private *devpriv = dev->private; unsigned long flags; @@ -1303,22 +1305,24 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev, if (ret) return ret; + /* Analog Input subdevice */ s = &dev->subdevices[0]; - /* analog input subdevice */ - dev->read_subdev = s; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF | SDF_CMD_READ; - /* WARNING: Number of inputs in differential mode is ignored */ - s->n_chan = 16; - s->len_chanlist = s->n_chan; - s->maxdata = board->is_16bit ? 0xffff : 0x0fff; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; + s->n_chan = 16; + s->maxdata = board->is_16bit ? 0xffff : 0x0fff; s->range_table = board->use_alt_range ? &cb_pcidas_alt_ranges : &cb_pcidas_ranges; - s->insn_read = cb_pcidas_ai_rinsn; - s->insn_config = ai_config_insn; - s->do_cmd = cb_pcidas_ai_cmd; - s->do_cmdtest = cb_pcidas_ai_cmdtest; - s->cancel = cb_pcidas_cancel; + s->insn_read = cb_pcidas_ai_insn_read; + s->insn_config = cb_pcidas_ai_insn_config; + if (dev->irq) { + dev->read_subdev = s; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = s->n_chan; + s->do_cmd = cb_pcidas_ai_cmd; + s->do_cmdtest = cb_pcidas_ai_cmdtest; + s->cancel = cb_pcidas_ai_cancel; + } /* Analog Output subdevice */ s = &dev->subdevices[1]; |