summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2013-03-22 09:43:45 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-25 11:41:51 -0700
commit9bffb75d7510c44ce227d940cd8663df911bc487 (patch)
treefb400f14d4955e1ff08f06c65cf70a058e02e34f
parent28a10930e6af5585ade2ef23eb8ce370d1450488 (diff)
downloadblackbird-op-linux-9bffb75d7510c44ce227d940cd8663df911bc487.tar.gz
blackbird-op-linux-9bffb75d7510c44ce227d940cd8663df911bc487.zip
staging: comedi: ni_labpc: fix command support with analog input subdevice
An interrupt is required for command support to work with the analog input subdevice. When used with the ISA driver, enabling the interrupt is optional. Fix the subdevice init so that command support is only enabled if the irq is available. Add some whitespace to the subdevice init. Change the 'maxdata' value to hex as this is more common in comedi drivers. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/comedi/drivers/ni_labpc.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c
index b6bfb2b626a8..ef9a206068fd 100644
--- a/drivers/staging/comedi/drivers/ni_labpc.c
+++ b/drivers/staging/comedi/drivers/ni_labpc.c
@@ -1758,18 +1758,20 @@ int labpc_common_attach(struct comedi_device *dev, unsigned long iobase,
/* analog input subdevice */
s = &dev->subdevices[0];
- dev->read_subdev = s;
- s->type = COMEDI_SUBD_AI;
- s->subdev_flags =
- SDF_READABLE | SDF_GROUND | SDF_COMMON | SDF_DIFF | SDF_CMD_READ;
- s->n_chan = 8;
- s->len_chanlist = 8;
- s->maxdata = (1 << 12) - 1; /* 12 bit resolution */
- s->range_table = board->ai_range_table;
- s->do_cmd = labpc_ai_cmd;
- s->do_cmdtest = labpc_ai_cmdtest;
- s->insn_read = labpc_ai_insn_read;
- s->cancel = labpc_cancel;
+ s->type = COMEDI_SUBD_AI;
+ s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON | SDF_DIFF;
+ s->n_chan = 8;
+ s->len_chanlist = 8;
+ s->maxdata = 0x0fff;
+ s->range_table = board->ai_range_table;
+ s->insn_read = labpc_ai_insn_read;
+ if (dev->irq) {
+ dev->read_subdev = s;
+ s->subdev_flags |= SDF_CMD_READ;
+ s->do_cmd = labpc_ai_cmd;
+ s->do_cmdtest = labpc_ai_cmdtest;
+ s->cancel = labpc_cancel;
+ }
/* analog output */
s = &dev->subdevices[1];
OpenPOWER on IntegriCloud