Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: comedi: ni_atmio16d: tidy up the irq support in atmio16d_attach()

Tidy up the code that does the request_irq().

Only hookup the commad support if the irq was sucessfully requested.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

H Hartley Sweeten and committed by
Greg Kroah-Hartman
ec9b2f4f d4bdba2f

+14 -20
+14 -20
drivers/staging/comedi/drivers/ni_atmio16d.c
··· 631 631 const struct atmio16_board_t *board = comedi_board(dev); 632 632 struct atmio16d_private *devpriv; 633 633 struct comedi_subdevice *s; 634 - unsigned int irq; 635 634 int ret; 636 635 637 636 ret = comedi_request_region(dev, it->options[0], ATMIO16D_SIZE); ··· 648 649 /* reset the atmio16d hardware */ 649 650 reset_atmio16d(dev); 650 651 651 - /* check if our interrupt is available and get it */ 652 - irq = it->options[1]; 653 - if (irq) { 654 - 655 - ret = request_irq(irq, atmio16d_interrupt, 0, "atmio16d", dev); 656 - if (ret < 0) { 657 - printk(KERN_INFO "failed to allocate irq %u\n", irq); 658 - return ret; 659 - } 660 - dev->irq = irq; 661 - printk(KERN_INFO "( irq = %u )\n", irq); 662 - } else { 663 - printk(KERN_INFO "( no irq )"); 652 + if (it->options[1]) { 653 + ret = request_irq(it->options[1], atmio16d_interrupt, 0, 654 + dev->board_name, dev); 655 + if (ret == 0) 656 + dev->irq = it->options[1]; 664 657 } 665 658 666 659 /* set device options */ ··· 668 677 669 678 /* setup sub-devices */ 670 679 s = &dev->subdevices[0]; 671 - dev->read_subdev = s; 672 680 /* ai subdevice */ 673 681 s->type = COMEDI_SUBD_AI; 674 - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_CMD_READ; 682 + s->subdev_flags = SDF_READABLE | SDF_GROUND; 675 683 s->n_chan = (devpriv->adc_mux ? 16 : 8); 676 - s->len_chanlist = 16; 677 684 s->insn_read = atmio16d_ai_insn_read; 678 - s->do_cmdtest = atmio16d_ai_cmdtest; 679 - s->do_cmd = atmio16d_ai_cmd; 680 - s->cancel = atmio16d_ai_cancel; 681 685 s->maxdata = 0xfff; /* 4095 decimal */ 682 686 switch (devpriv->adc_range) { 683 687 case adc_bipolar10: ··· 684 698 case adc_unipolar10: 685 699 s->range_table = &range_atmio16d_ai_unipolar; 686 700 break; 701 + } 702 + if (dev->irq) { 703 + dev->read_subdev = s; 704 + s->subdev_flags |= SDF_CMD_READ; 705 + s->len_chanlist = 16; 706 + s->do_cmdtest = atmio16d_ai_cmdtest; 707 + s->do_cmd = atmio16d_ai_cmd; 708 + s->cancel = atmio16d_ai_cancel; 687 709 } 688 710 689 711 /* ao subdevice */