Commit 66d10158 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: adl_pci9111: the irq is only needed for async command support

An irq is only needed for async command support, modify the attach of
the subdevices so that the command support is only hooked up if the irq
request was successful. Remove the then unnecessary sanity check in
pci9111_ai_do_cmd().
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 48108fe3
...@@ -470,11 +470,6 @@ static int pci9111_ai_do_cmd(struct comedi_device *dev, ...@@ -470,11 +470,6 @@ static int pci9111_ai_do_cmd(struct comedi_device *dev,
struct pci9111_private_data *dev_private = dev->private; struct pci9111_private_data *dev_private = dev->private;
struct comedi_cmd *async_cmd = &s->async->cmd; struct comedi_cmd *async_cmd = &s->async->cmd;
if (!dev->irq) {
comedi_error(dev,
"no irq assigned for PCI9111, cannot do hardware conversion");
return -1;
}
/* Set channel scan limit */ /* Set channel scan limit */
/* PCI9111 allows only scanning from channel 0 to channel n */ /* PCI9111 allows only scanning from channel 0 to channel n */
/* TODO: handle the case of an external multiplexer */ /* TODO: handle the case of an external multiplexer */
...@@ -858,11 +853,10 @@ static int pci9111_auto_attach(struct comedi_device *dev, ...@@ -858,11 +853,10 @@ static int pci9111_auto_attach(struct comedi_device *dev,
pci9111_reset(dev); pci9111_reset(dev);
if (pcidev->irq > 0) { if (pcidev->irq) {
ret = request_irq(pcidev->irq, pci9111_interrupt, ret = request_irq(pcidev->irq, pci9111_interrupt,
IRQF_SHARED, dev->board_name, dev); IRQF_SHARED, dev->board_name, dev);
if (ret) if (ret == 0)
return ret;
dev->irq = pcidev->irq; dev->irq = pcidev->irq;
} }
...@@ -871,18 +865,21 @@ static int pci9111_auto_attach(struct comedi_device *dev, ...@@ -871,18 +865,21 @@ static int pci9111_auto_attach(struct comedi_device *dev,
return ret; return ret;
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_CMD_READ; s->subdev_flags = SDF_READABLE | SDF_COMMON;
s->n_chan = 16; s->n_chan = 16;
s->maxdata = 0xffff; s->maxdata = 0xffff;
s->len_chanlist = 16;
s->range_table = &pci9111_ai_range; s->range_table = &pci9111_ai_range;
s->cancel = pci9111_ai_cancel;
s->insn_read = pci9111_ai_insn_read; s->insn_read = pci9111_ai_insn_read;
if (dev->irq) {
dev->read_subdev = s;
s->subdev_flags |= SDF_CMD_READ;
s->len_chanlist = s->n_chan;
s->do_cmdtest = pci9111_ai_do_cmd_test; s->do_cmdtest = pci9111_ai_do_cmd_test;
s->do_cmd = pci9111_ai_do_cmd; s->do_cmd = pci9111_ai_do_cmd;
s->cancel = pci9111_ai_cancel;
s->munge = pci9111_ai_munge; s->munge = pci9111_ai_munge;
}
s = &dev->subdevices[1]; s = &dev->subdevices[1];
s->type = COMEDI_SUBD_AO; s->type = COMEDI_SUBD_AO;
......
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