Commit 0c2e5532 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: dmm32at: tidy up the irq support in dmm32at_attach()

An irq is only needed by this driver in order to support async commands.
Since it is optional, modify the attach so that if the request_irq() fails
the attach does not fail.

Remove the printk noise about the irq.

Only hookup the async command support if the request_irq() was successful.
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 49220f91
...@@ -670,9 +670,6 @@ static int dmm32at_attach(struct comedi_device *dev, ...@@ -670,9 +670,6 @@ static int dmm32at_attach(struct comedi_device *dev,
int ret; int ret;
struct comedi_subdevice *s; struct comedi_subdevice *s;
unsigned char aihi, ailo, fifostat, aistat, intstat, airback; unsigned char aihi, ailo, fifostat, aistat, intstat, airback;
unsigned int irq;
irq = it->options[1];
ret = comedi_request_region(dev, it->options[0], DMM32AT_MEMSIZE); ret = comedi_request_region(dev, it->options[0], DMM32AT_MEMSIZE);
if (ret) if (ret)
...@@ -717,14 +714,11 @@ static int dmm32at_attach(struct comedi_device *dev, ...@@ -717,14 +714,11 @@ static int dmm32at_attach(struct comedi_device *dev,
return -EIO; return -EIO;
} }
/* board is there, register interrupt */ if (it->options[1]) {
if (irq) { ret = request_irq(it->options[1], dmm32at_isr, 0,
ret = request_irq(irq, dmm32at_isr, 0, dev->board_name, dev); dev->board_name, dev);
if (ret < 0) { if (ret == 0)
printk(KERN_ERR "dmm32at: irq conflict\n"); dev->irq = it->options[1];
return ret;
}
dev->irq = irq;
} }
devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
...@@ -736,20 +730,22 @@ static int dmm32at_attach(struct comedi_device *dev, ...@@ -736,20 +730,22 @@ static int dmm32at_attach(struct comedi_device *dev,
return ret; return ret;
s = &dev->subdevices[0]; s = &dev->subdevices[0];
dev->read_subdev = s;
/* analog input subdevice */ /* analog input subdevice */
s->type = COMEDI_SUBD_AI; s->type = COMEDI_SUBD_AI;
/* we support single-ended (ground) and differential */ /* we support single-ended (ground) and differential */
s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF | SDF_CMD_READ; s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF;
s->n_chan = 32; s->n_chan = 32;
s->maxdata = 0xffff; s->maxdata = 0xffff;
s->range_table = &dmm32at_airanges; s->range_table = &dmm32at_airanges;
s->len_chanlist = 32; /* This is the maximum chanlist length that
the board can handle */
s->insn_read = dmm32at_ai_rinsn; s->insn_read = dmm32at_ai_rinsn;
s->do_cmd = dmm32at_ai_cmd; if (dev->irq) {
s->do_cmdtest = dmm32at_ai_cmdtest; dev->read_subdev = s;
s->cancel = dmm32at_ai_cancel; s->subdev_flags |= SDF_CMD_READ;
s->len_chanlist = 32;
s->do_cmd = dmm32at_ai_cmd;
s->do_cmdtest = dmm32at_ai_cmdtest;
s->cancel = dmm32at_ai_cancel;
}
s = &dev->subdevices[1]; s = &dev->subdevices[1];
/* analog output subdevice */ /* analog output subdevice */
......
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