Skip to content

Commit

Permalink
staging: comedi: me_daq: analog output subdevice could be unused
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Oct 26, 2012
1 parent 10cba30 commit 43d51f8
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions drivers/staging/comedi/drivers/me_daq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 43d51f8

Please sign in to comment.