From: H Hartley Sweeten Date: Mon, 5 Oct 2015 21:23:05 +0000 (-0700) Subject: staging: comedi: quatech_daqp_cs: only hook up cmd support if we have an IRQ X-Git-Tag: firefly_0821_release~176^2~802^2~921 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7689f55b62836a5e5de2f9a5cd8d215071636013;p=firefly-linux-kernel-4.4.55.git staging: comedi: quatech_daqp_cs: only hook up cmd support if we have an IRQ Interrupts are only needed by this driver to support the analog input async commands. Don't hook up the command support if pcmcia_request_irq() fails instead of completely failing the (*auto_attach). Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index 82378263a317..bab3293a8705 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -732,25 +732,28 @@ static int daqp_auto_attach(struct comedi_device *dev, link->priv = dev; ret = pcmcia_request_irq(link, daqp_interrupt); - if (ret) - return ret; + if (ret == 0) + dev->irq = link->irq; ret = comedi_alloc_subdevices(dev, 4); if (ret) return ret; s = &dev->subdevices[0]; - dev->read_subdev = s; s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF | SDF_CMD_READ; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; s->n_chan = 8; - s->len_chanlist = 2048; s->maxdata = 0xffff; s->range_table = &range_daqp_ai; s->insn_read = daqp_ai_insn_read; - s->do_cmdtest = daqp_ai_cmdtest; - s->do_cmd = daqp_ai_cmd; - s->cancel = daqp_ai_cancel; + if (dev->irq) { + dev->read_subdev = s; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = 2048; + s->do_cmdtest = daqp_ai_cmdtest; + s->do_cmd = daqp_ai_cmd; + s->cancel = daqp_ai_cancel; + } s = &dev->subdevices[1]; s->type = COMEDI_SUBD_AO;