diff options
author | H Hartley Sweeten <hartleys@visionengravers.com> | 2012-10-25 22:07:17 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-26 16:20:01 (GMT) |
commit | 43d51f885a1e0901229ad479b61ed97aa2c103f6 (patch) | |
tree | 55f6458d1854260fa16d9558384e68031c2f7cba | |
parent | 10cba302edf32753a653659740e1688094f92c86 (diff) | |
download | linux-fsl-qoriq-43d51f885a1e0901229ad479b61ed97aa2c103f6.tar.xz |
staging: comedi: me_daq: analog output subdevice could be unused
One of the boards supported by this driver does not have analog
outputs. Fix the attach code to account for this.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/drivers/me_daq.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c index 182a184..f5ede1a 100644 --- a/drivers/staging/comedi/drivers/me_daq.c +++ b/drivers/staging/comedi/drivers/me_daq.c @@ -735,14 +735,18 @@ static int me_attach_pci(struct comedi_device *dev, struct pci_dev *pcidev) s->do_cmd = me_ai_do_cmd; s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITEABLE | SDF_COMMON; - s->n_chan = board->ao_channel_nbr; - s->maxdata = board->ao_resolution_mask; - s->len_chanlist = board->ao_channel_nbr; - s->range_table = board->ao_range_list; - s->insn_read = me_ao_insn_read; - s->insn_write = me_ao_insn_write; + if (board->ao_channel_nbr) { + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITEABLE | SDF_COMMON; + s->n_chan = board->ao_channel_nbr; + s->maxdata = board->ao_resolution_mask; + s->len_chanlist = board->ao_channel_nbr; + s->range_table = board->ao_range_list; + s->insn_read = me_ao_insn_read; + s->insn_write = me_ao_insn_write; + } else { + s->type = COMEDI_SUBD_UNUSED; + } s = &dev->subdevices[2]; s->type = COMEDI_SUBD_DIO; |