From: David Schleef Date: Sun, 4 Mar 2001 10:55:52 +0000 (+0000) Subject: fixes for bugs suggested by check_driver X-Git-Tag: r0_7_58~68 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d87cca05c192ad982ca5664dadb34e607cb483a1;p=comedi.git fixes for bugs suggested by check_driver --- diff --git a/comedi/drivers/adl_pci9118.c b/comedi/drivers/adl_pci9118.c index caf9d1da..b3431abc 100644 --- a/comedi/drivers/adl_pci9118.c +++ b/comedi/drivers/adl_pci9118.c @@ -1298,7 +1298,7 @@ static int pci9118_attach(comedi_device *dev,comedi_devconfig *it) request_region(devpriv->iobase_a, devpriv->iosize_a, "ADLink PCI-9118"); if (irq>0) { - if (request_irq(irq, interrupt_pci9118, SA_INTERRUPT, "ADLink PCI-9118", dev)) { + if (comedi_request_irq(irq, interrupt_pci9118, 0, "ADLink PCI-9118", dev)) { rt_printk(", unable to allocate IRQ %d, DISABLING IT", irq); irq=0; /* Can't use IRQ */ } else { diff --git a/comedi/drivers/check_driver b/comedi/drivers/check_driver index 035fb04d..b88bfb64 100755 --- a/comedi/drivers/check_driver +++ b/comedi/drivers/check_driver @@ -111,6 +111,7 @@ if grep 'comedi_cmd' ${driver} &>/dev/null;then echo "uses cmd" cmd=yes else + echo "W: doesn't use cmd" cmd=no fi @@ -118,6 +119,7 @@ if grep 'comedi_insn' ${driver} &>/dev/null;then echo "uses insn" insn=yes else + echo "W: doesn't use insn" insn=no fi @@ -169,4 +171,7 @@ if grep 'int init_module' ${driver} &>/dev/null;then echo "W: suggest using COMEDI_INITCLEANUP" fi +if grep 'range_unknown' ${driver} &>/dev/null;then + echo "W: uses range_unknown" +fi diff --git a/comedi/drivers/das16-new.c b/comedi/drivers/das16-new.c index 5b0db902..190bfbe2 100644 --- a/comedi/drivers/das16-new.c +++ b/comedi/drivers/das16-new.c @@ -1034,7 +1034,7 @@ static int das16_attach(comedi_device *dev, comedi_devconfig *it) /* now for the irq */ irq=it->options[1]; if(irq>0){ - if((ret=request_irq(irq,das16_interrupt,SA_INTERRUPT,"das16",dev))<0) + if((ret=comedi_request_irq(irq,das16_interrupt,0,"das16",dev))<0) return ret; dev->irq=irq; printk(" ( irq = %d )\n",irq); diff --git a/comedi/drivers/das16.c b/comedi/drivers/das16.c index 2952bf34..be34fd81 100644 --- a/comedi/drivers/das16.c +++ b/comedi/drivers/das16.c @@ -317,7 +317,7 @@ static int das16_attach(comedi_device *dev,comedi_devconfig *it) if(irq<0 || irq>=16 || irq_list[irq]<0){ return -EINVAL; } - if (request_irq(irq, das16_interrupt, SA_INTERRUPT, "das16", dev) == 0) { + if (comedi_request_irq(irq, das16_interrupt, 0, "das16", dev) == 0) { return -EIO; } dev->irq=irq; diff --git a/comedi/drivers/das6402.c b/comedi/drivers/das6402.c index 21669594..f7815cab 100644 --- a/comedi/drivers/das6402.c +++ b/comedi/drivers/das6402.c @@ -339,7 +339,7 @@ static int das6402_attach(comedi_device *dev,comedi_devconfig *it) irq=it->options[0]; printk(" ( irq = %d )", irq); - ret=request_irq(irq, intr_handler, 0, "das6402", dev); + ret=comedi_request_irq(irq, intr_handler, 0, "das6402", dev); if(ret<0){ printk("irq conflict\n"); return ret; diff --git a/comedi/drivers/dt2811.c b/comedi/drivers/dt2811.c index ffc6370e..0586f76c 100644 --- a/comedi/drivers/dt2811.c +++ b/comedi/drivers/dt2811.c @@ -203,6 +203,7 @@ comedi_driver driver_dt2811={ num_names: sizeof(boardtypes)/sizeof(boardtype), offset: sizeof(boardtype), }; +COMEDI_INITCLEANUP(driver_dt2811); static int dt2811_ai(comedi_device * dev, comedi_subdevice * s, comedi_trig * it); #if 0 @@ -327,7 +328,8 @@ static int dt2811_attach(comedi_device * dev, comedi_devconfig * it) i = inb(dev->iobase + DT2811_ADDATLO); i = inb(dev->iobase + DT2811_ADDATHI); printk("(irq = %d)\n", irq); - request_irq(irq, dt2811_interrupt, 0 * SA_INTERRUPT, driver_name, dev); + ret = comedi_request_irq(irq, dt2811_interrupt, 0, driver_name, dev); + if(ret<0)return -EIO; dev->irq = irq; } else if (irq == 0) { printk("(no irq)\n"); @@ -553,16 +555,3 @@ static int dt2811_do(comedi_device * dev, comedi_subdevice * s, comedi_trig * it return it->n_chan; } -#ifdef MODULE -int init_module(void) -{ - comedi_driver_register(&driver_dt2811); - - return 0; -} - -void cleanup_module(void) -{ - comedi_driver_unregister(&driver_dt2811); -} -#endif diff --git a/comedi/drivers/dt2814.c b/comedi/drivers/dt2814.c index dc0b96fe..b6909c3a 100644 --- a/comedi/drivers/dt2814.c +++ b/comedi/drivers/dt2814.c @@ -61,6 +61,7 @@ comedi_driver driver_dt2814={ attach: dt2814_attach, detach: dt2814_detach, }; +COMEDI_INITCLEANUP(driver_dt2814); static void dt2814_interrupt(int irq,void *dev,struct pt_regs * regs); @@ -304,7 +305,7 @@ static int dt2814_attach(comedi_device *dev,comedi_devconfig *it) dev->irq=0; if(irq>0){ printk("( irq = %d )\n",irq); - request_irq(irq,dt2814_interrupt,0*SA_INTERRUPT,"dt2814",dev); + comedi_request_irq(irq,dt2814_interrupt,0,"dt2814",dev); dev->irq=irq; }else if(irq==0){ printk("(no irq)\n"); @@ -387,17 +388,3 @@ static void dt2814_interrupt(int irq,void *d,struct pt_regs * regs) } } - -#ifdef MODULE -int init_module(void) -{ - comedi_driver_register(&driver_dt2814); - - return 0; -} - -void cleanup_module(void) -{ - comedi_driver_unregister(&driver_dt2814); -} -#endif diff --git a/comedi/drivers/dt2815.c b/comedi/drivers/dt2815.c index ebb96eea..c9ebe9b1 100644 --- a/comedi/drivers/dt2815.c +++ b/comedi/drivers/dt2815.c @@ -56,6 +56,7 @@ comedi_driver driver_dt2815={ attach: dt2815_attach, detach: dt2815_detach, }; +COMEDI_INITCLEANUP(driver_dt2815); static void dt2815_free_resources(comedi_device * dev); @@ -220,16 +221,3 @@ static int dt2815_detach(comedi_device * dev) return 0; } -#ifdef MODULE -int init_module(void) -{ - comedi_driver_register(&driver_dt2815); - - return 0; -} - -void cleanup_module(void) -{ - comedi_driver_unregister(&driver_dt2815); -} -#endif diff --git a/comedi/drivers/dt282x.c b/comedi/drivers/dt282x.c index abf27fc7..83f55c30 100644 --- a/comedi/drivers/dt282x.c +++ b/comedi/drivers/dt282x.c @@ -1438,7 +1438,8 @@ static int dt282x_attach(comedi_device * dev, comedi_devconfig * it) dev->irq = 0; if (irq > 0) { printk(" ( irq = %d )", irq); - request_irq(irq, dt282x_interrupt, SA_INTERRUPT, "dt282x", dev); + ret = comedi_request_irq(irq, dt282x_interrupt, 0, "dt282x", dev); + if(ret<0)return -EIO; dev->irq = irq; } else if (irq == 0) { printk(" (no irq)"); diff --git a/comedi/drivers/ni_atmio16d.c b/comedi/drivers/ni_atmio16d.c index 3e575864..88523646 100644 --- a/comedi/drivers/ni_atmio16d.c +++ b/comedi/drivers/ni_atmio16d.c @@ -146,6 +146,7 @@ comedi_driver driver_atmio16d={ num_names: n_atmio16_boards, offset: sizeof(atmio16_board_t), }; +COMEDI_INITCLEANUP(driver_atmio16d); /* range structs */ static comedi_lrange range_atmio16d_ai_10_bipolar = { 4, { @@ -726,8 +727,8 @@ static int atmio16d_attach(comedi_device * dev, comedi_devconfig * it) /* check if our interrupt is available and get it */ irq=it->options[1]; if(irq>0){ - if((ret=request_irq(irq,atmio16d_interrupt, - SA_INTERRUPT, "atmio16d", dev))<0) + if((ret=comedi_request_irq(irq,atmio16d_interrupt, + 0, "atmio16d", dev))<0) return ret; dev->irq=irq; printk("( irq = %d )\n",irq); @@ -850,17 +851,3 @@ static int atmio16d_detach(comedi_device * dev) return 0; } -#ifdef MODULE -int init_module(void) -{ - comedi_driver_register(&driver_atmio16d); - - return 0; -} - -void cleanup_module(void) -{ - comedi_driver_unregister(&driver_atmio16d); - -} -#endif diff --git a/comedi/drivers/ni_pcidio.c b/comedi/drivers/ni_pcidio.c index 10d0ca71..3ab3feaa 100644 --- a/comedi/drivers/ni_pcidio.c +++ b/comedi/drivers/ni_pcidio.c @@ -152,6 +152,7 @@ comedi_driver driver_pcidio={ attach: nidio_attach, detach: nidio_detach, }; +COMEDI_INITCLEANUP(driver_pcidio); typedef struct{ int dev_id; @@ -510,17 +511,3 @@ static int nidio_find_device(comedi_device *dev,int bus,int slot) return -EIO; } - -#ifdef MODULE -int init_module(void) -{ - comedi_driver_register(&driver_pcidio); - - return 0; -} - -void cleanup_module(void) -{ - comedi_driver_unregister(&driver_pcidio); -} -#endif diff --git a/comedi/drivers/ni_pcimio.c b/comedi/drivers/ni_pcimio.c index f469cc5c..84505d72 100644 --- a/comedi/drivers/ni_pcimio.c +++ b/comedi/drivers/ni_pcimio.c @@ -356,6 +356,7 @@ comedi_driver driver_pcimio={ attach: pcimio_attach, detach: pcimio_detach, }; +COMEDI_INITCLEANUP(driver_pcimio); /* How we access registers */ @@ -479,17 +480,3 @@ static int pcimio_find_device(comedi_device *dev,int bus,int slot) return -EIO; } - -#ifdef MODULE -int init_module(void) -{ - comedi_driver_register(&driver_pcimio); - - return 0; -} - -void cleanup_module(void) -{ - comedi_driver_unregister(&driver_pcimio); -} -#endif diff --git a/comedi/drivers/pcl711.c b/comedi/drivers/pcl711.c index 005ac94c..b4d28d5d 100644 --- a/comedi/drivers/pcl711.c +++ b/comedi/drivers/pcl711.c @@ -424,7 +424,7 @@ static int pcl711_attach(comedi_device * dev, comedi_devconfig * it) return -EINVAL; } if (irq) { - if (request_irq(irq, pcl711_interrupt, SA_INTERRUPT, "pcl711", dev)) { + if (comedi_request_irq(irq, pcl711_interrupt, 0, "pcl711", dev)) { printk("unable to allocate irq %d\n", irq); free_resources(dev); return -EINVAL; diff --git a/comedi/drivers/pcl724.c b/comedi/drivers/pcl724.c index 932977e6..41d340a6 100644 --- a/comedi/drivers/pcl724.c +++ b/comedi/drivers/pcl724.c @@ -143,7 +143,7 @@ static int pcl724_attach(comedi_device *dev,comedi_devconfig *it) rt_printk(", IRQ %d is out of allowed range, DISABLING IT",irq); irq=0; /* Bad IRQ */ } else { - if (request_irq(irq, interrupt_pcl724, SA_INTERRUPT, "pcl724", dev)) { + if (comedi_request_irq(irq, interrupt_pcl724, 0, "pcl724", dev)) { rt_printk(", unable to allocate IRQ %d, DISABLING IT", irq); irq=0; /* Can't use IRQ */ } else { diff --git a/comedi/drivers/pcl725.c b/comedi/drivers/pcl725.c index 9da84127..874f0500 100644 --- a/comedi/drivers/pcl725.c +++ b/comedi/drivers/pcl725.c @@ -32,6 +32,7 @@ comedi_driver driver_pcl725={ attach: pcl725_attach, detach: pcl725_detach, }; +COMEDI_INITCLEANUP(driver_pcl725); static int pcl725_do(comedi_device *dev,comedi_subdevice *s,comedi_trig *it); static int pcl725_di(comedi_device *dev,comedi_subdevice *s,comedi_trig *it); @@ -102,20 +103,9 @@ static int pcl725_attach(comedi_device *dev,comedi_devconfig *it) static int pcl725_detach(comedi_device *dev) { printk("comedi%d: pcl725: remove\n",dev->minor); - - return 0; -} -#ifdef MODULE -int init_module(void) -{ - comedi_driver_register(&driver_pcl725); + if(dev->iobase)release_region(dev->iobase,dev->iosize); return 0; } -void cleanup_module(void) -{ - comedi_driver_unregister(&driver_pcl725); -} -#endif diff --git a/comedi/drivers/pcl726.c b/comedi/drivers/pcl726.c index 33ea3046..354f2a2e 100644 --- a/comedi/drivers/pcl726.c +++ b/comedi/drivers/pcl726.c @@ -249,7 +249,7 @@ static int pcl726_attach(comedi_device *dev,comedi_devconfig *it) rt_printk(", IRQ %d is out of allowed range, DISABLING IT",irq); irq=0; /* Bad IRQ */ } else { - if (request_irq(irq, interrupt_pcl818, SA_INTERRUPT, "pcl726", dev)) { + if (comedi_request_irq(irq, interrupt_pcl818, 0, "pcl726", dev)) { rt_printk(", unable to allocate IRQ %d, DISABLING IT", irq); irq=0; /* Can't use IRQ */ } else { diff --git a/comedi/drivers/pcl812.c b/comedi/drivers/pcl812.c index 526a42b9..006b1122 100644 --- a/comedi/drivers/pcl812.c +++ b/comedi/drivers/pcl812.c @@ -192,6 +192,7 @@ comedi_driver driver_pcl812={ num_names: n_boardtypes, offset: sizeof(boardtype), }; +COMEDI_INITCLEANUP(driver_pcl812); typedef struct { #ifdef USE_DMA @@ -639,7 +640,7 @@ static int pcl812_attach(comedi_device * dev, comedi_devconfig * it) printk(", IRQ %d is out of allowed range, DISABLING IT", irq); irq = 0; /* Bad IRQ */ } else { - if (request_irq(irq, interrupt_pcl812, SA_INTERRUPT, "pcl812", dev)) { + if (comedi_request_irq(irq, interrupt_pcl812, 0, "pcl812", dev)) { printk(", unable to allocate IRQ %d, DISABLING IT", irq); irq = 0; /* Can't use IRQ */ } else { @@ -837,24 +838,6 @@ static int pcl812_detach(comedi_device * dev) return 0; } -/* -============================================================================== -*/ -#ifdef MODULE -int init_module(void) -{ - comedi_driver_register(&driver_pcl812); - - return 0; -} - -void cleanup_module(void) -{ - comedi_driver_unregister(&driver_pcl812); -} - -#endif - #if 0 /* @@Kluvi: magic crystaline sphere error correction, I hope diff --git a/comedi/drivers/pcl818.c b/comedi/drivers/pcl818.c index 14177002..c12add38 100644 --- a/comedi/drivers/pcl818.c +++ b/comedi/drivers/pcl818.c @@ -260,6 +260,7 @@ comedi_driver driver_pcl818={ num_names: n_boardtypes, offset: sizeof(boardtype), }; +COMEDI_INITCLEANUP(driver_pcl818); typedef struct { @@ -1362,7 +1363,7 @@ static int pcl818_attach(comedi_device * dev, comedi_devconfig * it) rt_printk(", IRQ %d is out of allowed range, DISABLING IT",irq); irq=0; /* Bad IRQ */ } else { - if (request_irq(irq, interrupt_pcl818, SA_INTERRUPT, "pcl818", dev)) { + if (comedi_request_irq(irq, interrupt_pcl818, 0, "pcl818", dev)) { rt_printk(", unable to allocate IRQ %d, DISABLING IT", irq); irq=0; /* Can't use IRQ */ } else { @@ -1388,7 +1389,7 @@ static int pcl818_attach(comedi_device * dev, comedi_devconfig * it) devpriv->rtc_iobase=RTC_PORT(0); devpriv->rtc_iosize=RTC_IO_EXTENT; RTC_lock++; - if (!request_irq(RTC_IRQ, interrupt_pcl818_ai_mode13_dma_rtc, SA_INTERRUPT|SA_SHIRQ, "pcl818 DMA (RTC)", dev)) { + if (!comedi_request_irq(RTC_IRQ, interrupt_pcl818_ai_mode13_dma_rtc, 0, "pcl818 DMA (RTC)", dev)) { devpriv->dma_rtc=1; devpriv->rtc_irq=RTC_IRQ; rt_printk(", dma_irq=%d", devpriv->rtc_irq); @@ -1585,20 +1586,3 @@ static int pcl818_detach(comedi_device * dev) return 0; } -/* -============================================================================== -*/ -#ifdef MODULE -int init_module(void) -{ - comedi_driver_register(&driver_pcl818); - return 0; -} - -void cleanup_module(void) -{ - // rt_printk("comedi: pcl818: unreg\n"); - comedi_driver_unregister(&driver_pcl818); - // rt_printk("comedi: pcl818: unreg end\n"); -} -#endif diff --git a/comedi/drivers/rti800.c b/comedi/drivers/rti800.c index 8bd3f640..933ca632 100644 --- a/comedi/drivers/rti800.c +++ b/comedi/drivers/rti800.c @@ -117,6 +117,7 @@ comedi_driver driver_rti800={ board_name: boardtypes, offset: sizeof(boardtype), }; +COMEDI_INITCLEANUP(driver_rti800); static void rti800_interrupt(int irq, void *dev, struct pt_regs *regs); @@ -314,7 +315,7 @@ static int rti800_attach(comedi_device * dev, comedi_devconfig * it) irq=it->options[1]; if(irq>0){ printk("( irq = %d )\n",irq); - if((ret=request_irq(irq,rti800_interrupt, SA_INTERRUPT, "rti800", dev))<0) + if((ret=comedi_request_irq(irq,rti800_interrupt, 0, "rti800", dev))<0) return ret; dev->irq=irq; }else if(irq == 0){ @@ -434,16 +435,3 @@ static int rti800_detach(comedi_device * dev) return 0; } -#ifdef MODULE -int init_module(void) -{ - comedi_driver_register(&driver_rti800); - - return 0; -} - -void cleanup_module(void) -{ - comedi_driver_unregister(&driver_rti800); -} -#endif diff --git a/comedi/drivers/rti802.c b/comedi/drivers/rti802.c index 4ab9c39f..382dd52d 100644 --- a/comedi/drivers/rti802.c +++ b/comedi/drivers/rti802.c @@ -50,6 +50,7 @@ comedi_driver driver_rti802={ attach: rti802_attach, detach: rti802_detach, }; +COMEDI_INITCLEANUP(driver_rti802); static void rti802_free_resources(comedi_device * dev); @@ -148,16 +149,3 @@ static int rti802_detach(comedi_device * dev) return 0; } -#ifdef MODULE -int init_module(void) -{ - comedi_driver_register(&driver_rti802); - - return 0; -} - -void cleanup_module(void) -{ - comedi_driver_unregister(&driver_rti802); -} -#endif