From: Frank Mori Hess Date: Mon, 4 Aug 2003 03:27:18 +0000 (+0000) Subject: new interrupt handler prototype for 2.6, plus some other 2.6 issues X-Git-Tag: r0_7_69~294 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3f0d98189a8aeb5f0fd4a2da8ba331f75a3a46d7;p=comedi.git new interrupt handler prototype for 2.6, plus some other 2.6 issues --- diff --git a/comedi/drivers/adl_pci9111.c b/comedi/drivers/adl_pci9111.c index 4ab78269..7bdb3571 100644 --- a/comedi/drivers/adl_pci9111.c +++ b/comedi/drivers/adl_pci9111.c @@ -922,7 +922,7 @@ static int pci9111_ai_do_cmd ( comedi_device *dev, #undef INTERRUPT_DEBUG -static void pci9111_interrupt (int irq, +static irqreturn_t pci9111_interrupt (int irq, void *p_device, struct pt_regs *regs) { @@ -932,16 +932,17 @@ static void pci9111_interrupt (int irq, unsigned long irq_flags; int i, data; int resolution = ((pci9111_board_struct *) dev->board_ptr)->ai_resolution; + int retval = IRQ_HANDLED; async = subdevice->async; comedi_spin_lock_irqsave (&dev->spinlock, irq_flags); - + if ((inb(dev_private->lcr_io_base+PLX9050_REGISTER_INTERRUPT_CONTROL) & PLX9050_LINTI1_STATUS) != 0) - { + { // Interrupt comes from fifo_half-full signal - + if (pci9111_is_fifo_full()) { comedi_spin_unlock_irqrestore (&dev->spinlock, irq_flags); @@ -951,20 +952,20 @@ static void pci9111_interrupt (int irq, async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; comedi_event (dev, subdevice, async->events); - return; + return IRQ_RETVAL(retval); } - + if (pci9111_is_fifo_half_full()) { #ifdef INTERRUPT_DEBUG printk (PCI9111_DRIVER_NAME ": fifo is half full\n"); #endif async->events |= COMEDI_CB_BLOCK; - + for (i=0;ievents |= COMEDI_CB_EOA; pci9111_ai_cancel (dev, subdevice); } - + // Very important, otherwise another interrupt request will be inserted // and will cause driver hangs on processing interrupt event (and cause a - // computer crash, and corrupt the source file of the driver you are - // working on, since you forgot to do a sync before test, and you cry, + // computer crash, and corrupt the source file of the driver you are + // working on, since you forgot to do a sync before test, and you cry, // and ...) - + pci9111_interrupt_clear(); comedi_spin_unlock_irqrestore (&dev->spinlock, irq_flags); comedi_event (dev, subdevice, async->events); + + return IRQ_RETVAL(retval); } - + // ------------------------------------------------------------------ // // INSTANT ANALOG INPUT OUTPUT SECTION diff --git a/comedi/drivers/adl_pci9118.c b/comedi/drivers/adl_pci9118.c index a016a9da..c0da4d4a 100644 --- a/comedi/drivers/adl_pci9118.c +++ b/comedi/drivers/adl_pci9118.c @@ -430,7 +430,7 @@ static int pci9118_insn_bits_do(comedi_device *dev,comedi_subdevice *s, comedi_i /* ============================================================================== */ -static void interrupt_pci9118_ai_mode4_switch(comedi_device *dev) +static void interrupt_pci9118_ai_mode4_switch(comedi_device *dev) { devpriv->AdFunctionReg=AdFunction_PDTrg|AdFunction_PETrg|AdFunction_AM; outl(devpriv->AdFunctionReg,dev->iobase+PCI9118_ADFUNC); @@ -439,7 +439,6 @@ static void interrupt_pci9118_ai_mode4_switch(comedi_device *dev) outl((devpriv->dmabuf_hw[1-devpriv->dma_actbuf]>>9)&0xff, dev->iobase + PCI9118_CNT0); devpriv->AdFunctionReg|=AdFunction_Start; outl(devpriv->AdFunctionReg,dev->iobase+PCI9118_ADFUNC); - } @@ -889,7 +888,7 @@ static void interrupt_pci9118_ai_dma(comedi_device *dev,comedi_subdevice *s, outl(devpriv->dmabuf_hw[0], devpriv->iobase_a+AMCC_OP_REG_MWAR); outl(devpriv->dmabuf_use_size[0], devpriv->iobase_a+AMCC_OP_REG_MWTC); if (devpriv->ai_do==4) - interrupt_pci9118_ai_mode4_switch(dev); + interrupt_pci9118_ai_mode4_switch(dev); } comedi_event(dev,s,s->async->events); @@ -898,25 +897,25 @@ static void interrupt_pci9118_ai_dma(comedi_device *dev,comedi_subdevice *s, /* ============================================================================== */ -static void interrupt_pci9118(int irq, void *d, struct pt_regs *regs) +static irqreturn_t interrupt_pci9118(int irq, void *d, struct pt_regs *regs) { comedi_device *dev = d; unsigned int int_daq=0,int_amcc,int_adstat; - + int_daq=inl(dev->iobase+PCI9118_INTSRC) & 0xf; // get IRQ reasons from card int_amcc=inl(devpriv->iobase_a+AMCC_OP_REG_INTCSR); // get INT register from AMCC chip // DPRINTK("INT daq=0x%01x amcc=0x%08x MWAR=0x%08x MWTC=0x%08x ADSTAT=0x%02x ai_do=%d\n", int_daq, int_amcc, inl(devpriv->iobase_a+AMCC_OP_REG_MWAR), inl(devpriv->iobase_a+AMCC_OP_REG_MWTC), inw(dev->iobase+PCI9118_ADSTAT)&0x1ff,devpriv->ai_do); if ((!int_daq)&&(!(int_amcc&ANY_S593X_INT))) - return; // interrupt from other source + return IRQ_NONE; // interrupt from other source outl(int_amcc|0x00ff0000, devpriv->iobase_a+AMCC_OP_REG_INTCSR); // shutdown IRQ reasons in AMCC int_adstat=inw(dev->iobase+PCI9118_ADSTAT)&0x1ff; // get STATUS register if (devpriv->ai_do) { - if (devpriv->ai12_startstop) + if (devpriv->ai12_startstop) if ((int_adstat&AdStatus_DTH)&&(int_daq&Int_DTrg)) { // start stop of measure if (devpriv->ai12_startstop&START_AI_EXT) { devpriv->ai12_startstop&=~START_AI_EXT; @@ -936,6 +935,7 @@ static void interrupt_pci9118(int irq, void *d, struct pt_regs *regs) (devpriv->int_ai_func)(dev,dev->subdevices + 0,int_adstat,int_amcc,int_daq); } + return IRQ_HANDLED; } /* diff --git a/comedi/drivers/adv_pci1710.c b/comedi/drivers/adv_pci1710.c index 9366c478..fbee3e37 100644 --- a/comedi/drivers/adv_pci1710.c +++ b/comedi/drivers/adv_pci1710.c @@ -610,19 +610,20 @@ static void interrupt_pci1710_half_fifo(void *d) outb(0, dev->iobase + PCI171x_CLRINT); // clear our INT request DPRINTK("adv_pci1710 EDBG: END: interrupt_pci1710_half_fifo(...)\n"); - comedi_event(dev,s,s->async->events); + comedi_event(dev,s,s->async->events); } -/* +/* ============================================================================== */ -static void interrupt_service_pci1710(int irq, void *d, struct pt_regs *regs) +static irqreturn_t interrupt_service_pci1710(int irq, void *d, struct pt_regs *regs) { - comedi_device *dev = d; - + comedi_device *dev = d; + int retval = IRQ_HANDLED; + DPRINTK("adv_pci1710 EDBG: BGN: interrupt_service_pci1710(%d,...)\n",irq); if (!(inw(dev->iobase + PCI171x_STATUS) & Status_IRQ)) // is this interrupt from our board? - return; // no, exit + return IRQ_NONE; // no, exit DPRINTK("adv_pci1710 EDBG: interrupt_service_pci1710() ST: %4x\n",inw(dev->iobase + PCI171x_STATUS)); @@ -636,7 +637,7 @@ static void interrupt_service_pci1710(int irq, void *d, struct pt_regs *regs) outw(devpriv->CntrlReg, dev->iobase+PCI171x_CONTROL); // start pacer start_pacer(dev, 1, devpriv->ai_et_div1, devpriv->ai_et_div2); - return; + return IRQ_RETVAL(retval); } if (devpriv->ai_eos) { // We use FIFO half full INT or not? interrupt_pci1710_every_sample(d); @@ -644,12 +645,13 @@ static void interrupt_service_pci1710(int irq, void *d, struct pt_regs *regs) interrupt_pci1710_half_fifo(d); } DPRINTK("adv_pci1710 EDBG: END: interrupt_service_pci1710(...)\n"); + return IRQ_RETVAL(retval); } -/* +/* ============================================================================== */ -static int pci171x_ai_docmd_and_mode(int mode, comedi_device * dev, comedi_subdevice * s) +static int pci171x_ai_docmd_and_mode(int mode, comedi_device * dev, comedi_subdevice * s) { unsigned int divisor1, divisor2; unsigned int seglen; diff --git a/comedi/drivers/amplc_pc236.c b/comedi/drivers/amplc_pc236.c index 6706e712..2b97cba9 100644 --- a/comedi/drivers/amplc_pc236.c +++ b/comedi/drivers/amplc_pc236.c @@ -154,7 +154,7 @@ static int pc236_intr_cmdtest(comedi_device *dev,comedi_subdevice *s, comedi_cmd *cmd); static int pc236_intr_cmd(comedi_device *dev,comedi_subdevice *s); static int pc236_intr_cancel(comedi_device *dev,comedi_subdevice *s); -static void pc236_interrupt(int irq,void *d,struct pt_regs *regs); +static irqreturn_t pc236_interrupt(int irq,void *d,struct pt_regs *regs); /* * Attach is called by the Comedi core to configure the driver @@ -536,17 +536,19 @@ static int pc236_intr_cancel(comedi_device *dev,comedi_subdevice *s) * Interrupt service routine. * Based on the comedi_parport driver. */ -static void pc236_interrupt(int irq,void *d,struct pt_regs *regs) +static irqreturn_t pc236_interrupt(int irq,void *d,struct pt_regs *regs) { comedi_device *dev=d; comedi_subdevice *s=dev->subdevices+1; + int retval = IRQ_HANDLED; - if(!pc236_intr_check(dev)) - return; + if(!pc236_intr_check(dev)) + return IRQ_RETVAL(retval); comedi_buf_put(s->async,0); s->async->events |= COMEDI_CB_EOS; - + comedi_event(dev,s,s->async->events); + return IRQ_RETVAL(retval); } diff --git a/comedi/drivers/amplc_pci230.c b/comedi/drivers/amplc_pci230.c index c1e85b36..886f2611 100644 --- a/comedi/drivers/amplc_pci230.c +++ b/comedi/drivers/amplc_pci230.c @@ -249,7 +249,7 @@ static void pci230_z2_ct2(comedi_device *dev, unsigned int *ns,int round); static void pci230_cancel_ct0(comedi_device *dev); static void pci230_cancel_ct1(comedi_device *dev); static void pci230_cancel_ct2(comedi_device *dev); -static void pci230_interrupt(int irq, void *d, struct pt_regs *regs); +static irqreturn_t pci230_interrupt(int irq, void *d, struct pt_regs *regs); static int pci230_ao_cmdtest(comedi_device *dev,comedi_subdevice *s, comedi_cmd *cmd); static int pci230_ao_cmd(comedi_device *dev, comedi_subdevice *s); static int pci230_ao_cancel(comedi_device *dev, comedi_subdevice *s); @@ -1123,11 +1123,12 @@ static void pci230_cancel_ct2(comedi_device *dev) } /* Interrupt handler */ -static void pci230_interrupt(int irq, void *d, struct pt_regs *regs) +static irqreturn_t pci230_interrupt(int irq, void *d, struct pt_regs *regs) { int status_int; comedi_device *dev = (comedi_device*) d; comedi_subdevice *s; + int retval = IRQ_HANDLED; /* Read interrupt status/enable register. */ status_int = inb(devpriv->pci_iobase + PCI230_INT_SCE); @@ -1163,7 +1164,7 @@ static void pci230_interrupt(int irq, void *d, struct pt_regs *regs) s->async->events = 0; } - return; + return IRQ_RETVAL(retval); } static void pci230_handle_ao(comedi_device *dev, comedi_subdevice *s) { diff --git a/comedi/drivers/cb_das16_cs.c b/comedi/drivers/cb_das16_cs.c index 4917eb2b..deb61284 100644 --- a/comedi/drivers/cb_das16_cs.c +++ b/comedi/drivers/cb_das16_cs.c @@ -104,7 +104,7 @@ static comedi_lrange das16cs_ai_range = { 4, { }}; -static void das16cs_interrupt(int irq, void *d, struct pt_regs *regs); +static irqreturn_t das16cs_interrupt(int irq, void *d, struct pt_regs *regs); static int das16cs_ai_rinsn(comedi_device *dev,comedi_subdevice *s, comedi_insn *insn,lsampl_t *data); static int das16cs_ai_cmd(comedi_device *dev,comedi_subdevice *s); @@ -271,10 +271,10 @@ static int das16cs_detach(comedi_device *dev) } -static void das16cs_interrupt(int irq, void *d, struct pt_regs *regs) +static irqreturn_t das16cs_interrupt(int irq, void *d, struct pt_regs *regs) { //comedi_device *dev = d; - + return IRQ_HANDLED; } /* @@ -713,7 +713,7 @@ typedef struct local_info_t { /*====================================================================*/ -static void cs_error(client_handle_t handle, int func, int ret) +static void my_cs_error(client_handle_t handle, int func, int ret) { error_info_t err = { func, ret }; CardServices(ReportError, handle, &err); @@ -785,7 +785,7 @@ static dev_link_t *das16cs_pcmcia_attach(void) client_reg.event_callback_args.client_data = link; ret = CardServices(RegisterClient, &link->handle, &client_reg); if (ret != CS_SUCCESS) { - cs_error(link->handle, RegisterClient, ret); + my_cs_error(link->handle, RegisterClient, ret); das16cs_pcmcia_detach(link); return NULL; } @@ -1017,7 +1017,7 @@ static void das16cs_pcmcia_config(dev_link_t *link) return; cs_failed: - cs_error(link->handle, last_fn, last_ret); + my_cs_error(link->handle, last_fn, last_ret); das16cs_pcmcia_release((u_long)link); } /* das16cs_pcmcia_config */ diff --git a/comedi/drivers/cb_pcidas.c b/comedi/drivers/cb_pcidas.c index ef68f5b9..9be515fc 100644 --- a/comedi/drivers/cb_pcidas.c +++ b/comedi/drivers/cb_pcidas.c @@ -467,7 +467,7 @@ static int cb_pcidas_ao_cmd(comedi_device *dev,comedi_subdevice *s); static int cb_pcidas_ao_inttrig(comedi_device *dev, comedi_subdevice *subdev, unsigned int trig_num); static int cb_pcidas_ao_cmdtest(comedi_device *dev,comedi_subdevice *s, comedi_cmd *cmd); -static void cb_pcidas_interrupt(int irq, void *d, struct pt_regs *regs); +static irqreturn_t cb_pcidas_interrupt(int irq, void *d, struct pt_regs *regs); static void handle_ao_interrupt(comedi_device *dev, unsigned int status); static int cb_pcidas_cancel(comedi_device *dev, comedi_subdevice *s); static int cb_pcidas_ao_cancel(comedi_device *dev, comedi_subdevice *s); @@ -1506,7 +1506,7 @@ static int cb_pcidas_ao_inttrig(comedi_device *dev, comedi_subdevice *s, unsigne return 0; } -static void cb_pcidas_interrupt(int irq, void *d, struct pt_regs *regs) +static irqreturn_t cb_pcidas_interrupt(int irq, void *d, struct pt_regs *regs) { comedi_device *dev = (comedi_device*) d; comedi_subdevice *s = dev->read_subdev; @@ -1516,7 +1516,8 @@ static void cb_pcidas_interrupt(int irq, void *d, struct pt_regs *regs) unsigned int num_samples, i; static const int timeout = 10000; unsigned long flags; - + int retval = IRQ_HANDLED; + if(dev->attached == 0) { comedi_error(dev, "premature interrupt"); @@ -1532,7 +1533,7 @@ static void cb_pcidas_interrupt(int irq, void *d, struct pt_regs *regs) #endif if( ( INTCSR_INTR_ASSERTED & s5933_status ) == 0 ) - return; + return IRQ_NONE; // make sure mailbox 4 is empty inl_p(devpriv->s5933_config + AMCC_OP_REG_IMB4); @@ -1620,7 +1621,7 @@ static void cb_pcidas_interrupt(int irq, void *d, struct pt_regs *regs) comedi_event(dev, s, async->events); - return; + return IRQ_RETVAL(retval); } static void handle_ao_interrupt(comedi_device *dev, unsigned int status) diff --git a/comedi/drivers/cb_pcidas64.c b/comedi/drivers/cb_pcidas64.c index 7a48da37..73909473 100644 --- a/comedi/drivers/cb_pcidas64.c +++ b/comedi/drivers/cb_pcidas64.c @@ -1065,7 +1065,7 @@ static int ai_cmdtest(comedi_device *dev,comedi_subdevice *s, comedi_cmd *cmd); //static int ao_cmd(comedi_device *dev,comedi_subdevice *s); //static int ao_inttrig(comedi_device *dev, comedi_subdevice *subdev, unsigned int trig_num); //static int ao_cmdtest(comedi_device *dev,comedi_subdevice *s, comedi_cmd *cmd); -static void handle_interrupt(int irq, void *d, struct pt_regs *regs); +static irqreturn_t handle_interrupt(int irq, void *d, struct pt_regs *regs); static int ai_cancel(comedi_device *dev, comedi_subdevice *s); //static int ao_cancel(comedi_device *dev, comedi_subdevice *s); static int dio_callback(int dir, int port, int data, unsigned long arg); @@ -2567,7 +2567,7 @@ static void drain_dma_buffers(comedi_device *dev, unsigned int channel) // XXX check for buffer overrun somehow } -static void handle_interrupt(int irq, void *d, struct pt_regs *regs) +static irqreturn_t handle_interrupt(int irq, void *d, struct pt_regs *regs) { comedi_device *dev = d; comedi_subdevice *s = dev->read_subdev; @@ -2578,6 +2578,7 @@ static void handle_interrupt(int irq, void *d, struct pt_regs *regs) uint32_t plx_bits; uint8_t dma0_status, dma1_status; unsigned long flags; + int retval = IRQ_HANDLED; plx_status = readl(priv(dev)->plx9080_iobase + PLX_INTRCS_REG); status = readw(priv(dev)->main_iobase + HW_STATUS_REG); @@ -2663,7 +2664,7 @@ static void handle_interrupt(int irq, void *d, struct pt_regs *regs) DEBUG_PRINT("exiting handler\n"); - return; + return IRQ_RETVAL( retval ); } void abort_dma(comedi_device *dev, unsigned int channel) diff --git a/comedi/drivers/daqboard2000.c b/comedi/drivers/daqboard2000.c index 1cb8e717..6847c382 100644 --- a/comedi/drivers/daqboard2000.c +++ b/comedi/drivers/daqboard2000.c @@ -683,12 +683,6 @@ static int daqboard2000_attach(comedi_device *dev, comedi_devconfig *it) printk("comedi%d: daqboard2000:", dev->minor); - if(!pci_present()) { - printk(" PCI bus not present!\n"); - result = -EIO; - goto out; - } - /* FIXME: we should handle multiple cards, have to make David decide how, so we will be consistent among all PCI card drivers... */ card = pci_find_device(0x1616, 0x0409, NULL); diff --git a/comedi/drivers/das16.c b/comedi/drivers/das16.c index 19dca1b8..284a75f4 100644 --- a/comedi/drivers/das16.c +++ b/comedi/drivers/das16.c @@ -336,7 +336,7 @@ static int das16_cmd_exec(comedi_device *dev,comedi_subdevice *s); static int das16_cancel(comedi_device *dev, comedi_subdevice *s); static void das16_reset(comedi_device *dev); -static void das16_dma_interrupt(int irq, void *d, struct pt_regs *regs); +static irqreturn_t das16_dma_interrupt(int irq, void *d, struct pt_regs *regs); static void das16_timer_interrupt(unsigned long arg); static void das16_interrupt(comedi_device *dev); @@ -1148,7 +1148,7 @@ static int das16_ao_winsn(comedi_device *dev,comedi_subdevice *s,comedi_insn *in } -static void das16_dma_interrupt(int irq, void *d, struct pt_regs *regs) +static irqreturn_t das16_dma_interrupt(int irq, void *d, struct pt_regs *regs) { int status; comedi_device *dev = d; @@ -1158,13 +1158,14 @@ static void das16_dma_interrupt(int irq, void *d, struct pt_regs *regs) if((status & DAS16_INT ) == 0) { DEBUG_PRINT( "spurious interrupt\n" ); - return; + return IRQ_NONE; } /* clear interrupt */ outb(0x00, dev->iobase + DAS16_STATUS); das16_interrupt(dev); + return IRQ_HANDLED; } static void das16_timer_interrupt(unsigned long arg) diff --git a/comedi/drivers/das16m1.c b/comedi/drivers/das16m1.c index 9e6a3a6e..0399476c 100644 --- a/comedi/drivers/das16m1.c +++ b/comedi/drivers/das16m1.c @@ -141,7 +141,7 @@ static int das16m1_cmd_exec(comedi_device *dev,comedi_subdevice *s); static int das16m1_cancel(comedi_device *dev, comedi_subdevice *s); static int das16m1_poll(comedi_device *dev, comedi_subdevice *s); -static void das16m1_interrupt(int irq, void *d, struct pt_regs *regs); +static irqreturn_t das16m1_interrupt(int irq, void *d, struct pt_regs *regs); static void das16m1_handler(comedi_device *dev, unsigned int status); static unsigned int das16m1_set_pacer(comedi_device *dev, unsigned int ns, int round_flag); @@ -464,7 +464,7 @@ static int das16m1_poll(comedi_device *dev, comedi_subdevice *s) return s->async->buf_write_count - s->async->buf_read_count; } -static void das16m1_interrupt(int irq, void *d, struct pt_regs *regs) +static irqreturn_t das16m1_interrupt(int irq, void *d, struct pt_regs *regs) { int status; comedi_device *dev = d; @@ -472,7 +472,7 @@ static void das16m1_interrupt(int irq, void *d, struct pt_regs *regs) if(dev->attached == 0) { comedi_error(dev, "premature interrupt"); - return; + return IRQ_HANDLED; } // prevent race with comedi_poll() @@ -484,7 +484,7 @@ static void das16m1_interrupt(int irq, void *d, struct pt_regs *regs) { comedi_error(dev, "spurious interrupt"); spin_unlock(&dev->spinlock); - return; + return IRQ_NONE; } das16m1_handler(dev, status); @@ -493,6 +493,7 @@ static void das16m1_interrupt(int irq, void *d, struct pt_regs *regs) outb(0, dev->iobase + DAS16M1_CLEAR_INTR); spin_unlock(&dev->spinlock); + return IRQ_HANDLED; } static void munge_sample_array( sampl_t *array, unsigned int num_elements ) diff --git a/comedi/drivers/das1800.c b/comedi/drivers/das1800.c index b575c853..0c88596d 100644 --- a/comedi/drivers/das1800.c +++ b/comedi/drivers/das1800.c @@ -182,7 +182,7 @@ static int das1800_attach(comedi_device *dev, comedi_devconfig *it); static int das1800_detach(comedi_device *dev); static int das1800_probe(comedi_device *dev); static int das1800_cancel(comedi_device *dev, comedi_subdevice *s); -static void das1800_interrupt(int irq, void *d, struct pt_regs *regs); +static irqreturn_t das1800_interrupt(int irq, void *d, struct pt_regs *regs); static int das1800_ai_poll(comedi_device *dev,comedi_subdevice *s); static void das1800_ai_handler(comedi_device *dev); static void das1800_handle_dma(comedi_device *dev, comedi_subdevice *s, unsigned int status); @@ -885,7 +885,7 @@ static int das1800_ai_poll(comedi_device *dev,comedi_subdevice *s) return s->async->buf_write_count - s->async->buf_read_count; } -static void das1800_interrupt(int irq, void *d, struct pt_regs *regs) +static irqreturn_t das1800_interrupt(int irq, void *d, struct pt_regs *regs) { comedi_device *dev = d; unsigned int status; @@ -893,7 +893,7 @@ static void das1800_interrupt(int irq, void *d, struct pt_regs *regs) if(dev->attached == 0) { comedi_error(dev, "premature interrupt"); - return; + return IRQ_HANDLED; } /* Prevent race with das1800_ai_poll() on multi processor systems. @@ -905,7 +905,7 @@ static void das1800_interrupt(int irq, void *d, struct pt_regs *regs) if(!(status & INT)) { spin_unlock(&dev->spinlock); - return; + return IRQ_NONE; } /* clear the interrupt status bit INT*/ outb(CLEAR_INTR_MASK & ~INT, dev->iobase + DAS1800_STATUS); @@ -913,6 +913,7 @@ static void das1800_interrupt(int irq, void *d, struct pt_regs *regs) das1800_ai_handler(dev); spin_unlock(&dev->spinlock); + return IRQ_HANDLED; } // the guts of the interrupt handler, that is shared with das1800_ai_poll diff --git a/comedi/drivers/das6402.c b/comedi/drivers/das6402.c index a66d7591..5cdfe909 100644 --- a/comedi/drivers/das6402.c +++ b/comedi/drivers/das6402.c @@ -152,14 +152,14 @@ static void das6402_setcounter(comedi_device *dev) outb_p(p,dev->iobase+14); } -static void intr_handler(int irq,void *d,struct pt_regs *regs) +static irqreturn_t intr_handler(int irq,void *d,struct pt_regs *regs) { comedi_device *dev=d; comedi_subdevice *s=dev->subdevices; if (devpriv->das6402_ignoreirq){ printk("das6402: BUG: spurious interrupt\n"); - return; + return IRQ_HANDLED; } #ifdef DEBUG @@ -182,6 +182,7 @@ static void intr_handler(int irq,void *d,struct pt_regs *regs) outb(0x01,dev->iobase+8); /* clear only the interrupt flip-flop */ comedi_event(dev,s,s->async->events); + return IRQ_HANDLED; } #if 0 diff --git a/comedi/drivers/das800.c b/comedi/drivers/das800.c index ed347527..60d878dc 100644 --- a/comedi/drivers/das800.c +++ b/comedi/drivers/das800.c @@ -255,7 +255,7 @@ static comedi_driver driver_das800={ offset: sizeof(das800_board), }; -static void das800_interrupt(int irq, void *d, struct pt_regs *regs); +static irqreturn_t das800_interrupt(int irq, void *d, struct pt_regs *regs); static void enable_das800(comedi_device *dev); static void disable_das800(comedi_device *dev); static int das800_ai_do_cmdtest(comedi_device *dev,comedi_subdevice *s,comedi_cmd *cmd); @@ -345,7 +345,7 @@ static int das800_probe(comedi_device *dev) COMEDI_INITCLEANUP(driver_das800); /* interrupt service routine */ -static void das800_interrupt(int irq, void *d, struct pt_regs *regs) +static irqreturn_t das800_interrupt(int irq, void *d, struct pt_regs *regs) { short i; /* loop index */ sampl_t dataPoint = 0; @@ -361,10 +361,10 @@ static void das800_interrupt(int irq, void *d, struct pt_regs *regs) status = inb(dev->iobase + DAS800_STATUS); /* if interrupt was not generated by board or driver not attached, quit */ - if(!(status & IRQ) || !(dev->attached)) - { - return; - } + if(!(status & IRQ) ) + return IRQ_NONE; + if(!(dev->attached)) + return IRQ_HANDLED; /* wait until here to initialize async, since we will get null dereference * if interrupt occurs before driver is fully attached! @@ -379,7 +379,7 @@ static void das800_interrupt(int irq, void *d, struct pt_regs *regs) if(status == 0) { comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags); - return; + return IRQ_HANDLED; } /* loop while card's fifo is not empty (and limit to half fifo for cio-das802/16) */ @@ -430,7 +430,7 @@ static void das800_interrupt(int irq, void *d, struct pt_regs *regs) async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; comedi_event(dev, s, async->events); async->events = 0; - return; + return IRQ_HANDLED; } if(devpriv->count > 0 || devpriv->forever == 1) { @@ -447,7 +447,7 @@ static void das800_interrupt(int irq, void *d, struct pt_regs *regs) comedi_spin_unlock_irqrestore(&dev->spinlock, irq_flags); comedi_event(dev, s, async->events); async->events = 0; - return; + return IRQ_HANDLED; } static int das800_attach(comedi_device *dev, comedi_devconfig *it) diff --git a/comedi/drivers/dt2814.c b/comedi/drivers/dt2814.c index 629348f4..30eb151b 100644 --- a/comedi/drivers/dt2814.c +++ b/comedi/drivers/dt2814.c @@ -70,7 +70,7 @@ static comedi_driver driver_dt2814={ }; COMEDI_INITCLEANUP(driver_dt2814); -static void dt2814_interrupt(int irq,void *dev,struct pt_regs * regs); +static irqreturn_t dt2814_interrupt(int irq,void *dev,struct pt_regs * regs); typedef struct{ int ntrig; @@ -326,37 +326,35 @@ static int dt2814_detach(comedi_device *dev) } -static void dt2814_interrupt(int irq,void *d,struct pt_regs * regs) +static irqreturn_t dt2814_interrupt(int irq,void *d,struct pt_regs * regs) { - int lo,hi; - comedi_device *dev=d; + int lo,hi; + comedi_device *dev=d; comedi_subdevice *s = dev->subdevices + 0; int data; - hi=inb(dev->iobase+DT2814_DATA); - lo=inb(dev->iobase+DT2814_DATA); + hi=inb(dev->iobase+DT2814_DATA); + lo=inb(dev->iobase+DT2814_DATA); - data=(hi<<4)|(lo>>4); + data=(hi<<4)|(lo>>4); if(!(--devpriv->ntrig)){ - int flags,i; + int i; outb(0,dev->iobase+DT2814_CSR); /* note: turning off timed mode triggers another sample. */ - save_flags(flags); - cli(); /* FIXME */ for(i=0;iiobase+DT2814_CSR)&DT2814_FINISH) break; } inb(dev->iobase+DT2814_DATA); inb(dev->iobase+DT2814_DATA); - restore_flags(flags); - + s->async->events |= COMEDI_CB_EOA; } comedi_event(dev,s,s->async->events); + return IRQ_HANDLED; } diff --git a/comedi/drivers/dt282x.c b/comedi/drivers/dt282x.c index c2e68ad0..79530574 100644 --- a/comedi/drivers/dt282x.c +++ b/comedi/drivers/dt282x.c @@ -569,7 +569,7 @@ static int prep_ao_dma(comedi_device * dev,int chan,int n) return n; } -static void dt282x_interrupt(int irq, void *d, struct pt_regs *regs) +static irqreturn_t dt282x_interrupt(int irq, void *d, struct pt_regs *regs) { comedi_device *dev = d; comedi_subdevice *s = dev->subdevices+0; @@ -583,8 +583,8 @@ static void dt282x_interrupt(int irq, void *d, struct pt_regs *regs) comedi_error(dev, "A/D error"); dt282x_ai_cancel(dev,s); s->async->events |= COMEDI_CB_ERROR; - comedi_event(dev,s,s->async->events); - return; + comedi_event(dev,s,s->async->events); + return IRQ_HANDLED; } supcsr = inw(dev->iobase + DT2821_SUPCSR); /*printk("supcsr=%02x\n",supcsr);*/ @@ -593,7 +593,7 @@ static void dt282x_interrupt(int irq, void *d, struct pt_regs *regs) dt282x_ai_dma_interrupt(dev); else dt282x_ao_dma_interrupt(dev); - return; + return IRQ_HANDLED; } if ((dacsr = inw(dev->iobase + DT2821_DACSR)) & DT2821_DAERR) { #if 0 @@ -606,8 +606,8 @@ static void dt282x_interrupt(int irq, void *d, struct pt_regs *regs) comedi_error(dev, "D/A error"); dt282x_ao_cancel(dev,s_ao); s->async->events |= COMEDI_CB_ERROR; - comedi_event(dev,s_ao,s->async->events); - return; + comedi_event(dev,s_ao,s->async->events); + return IRQ_HANDLED; } if (adcsr & DT2821_ADDONE) { data = (sampl_t) inw(dev->iobase + DT2821_ADDAT); @@ -628,9 +628,10 @@ static void dt282x_interrupt(int irq, void *d, struct pt_regs *regs) update_supcsr(DT2821_STRIG); } - comedi_event(dev,s,s->async->events); - return; + comedi_event(dev,s,s->async->events); + return IRQ_HANDLED; } + return IRQ_HANDLED; } @@ -1166,8 +1167,7 @@ enum{ opt_iobase=0, opt_irq, opt_dma1, opt_dma2, /* i/o base, irq, dma channels */ static int dt282x_attach(comedi_device * dev, comedi_devconfig * it) { - int i, irqs, irq; - long flags; + int i, irq; int ret; comedi_subdevice *s; int iobase; @@ -1213,7 +1213,11 @@ static int dt282x_attach(comedi_device * dev, comedi_devconfig * it) /* should do board test */ irq = it->options[opt_irq]; +#if 0 if (irq < 0) { + unsigned long flags; + int irqs; + save_flags(flags); sti(); irqs = probe_irq_on(); @@ -1228,7 +1232,7 @@ static int dt282x_attach(comedi_device * dev, comedi_devconfig * it) printk(" error probing irq (bad)"); } } - dev->irq = 0; +#endif if (irq > 0) { printk(" ( irq = %d )", irq); ret = comedi_request_irq(irq, dt282x_interrupt, 0, "dt282x", dev); diff --git a/comedi/drivers/dt3000.c b/comedi/drivers/dt3000.c index 3e4bb7c2..b04bea83 100644 --- a/comedi/drivers/dt3000.c +++ b/comedi/drivers/dt3000.c @@ -333,7 +333,7 @@ static void dt3k_writesingle(comedi_device *dev,unsigned int subsys, static int debug_n_ints = 0; -static void dt3k_interrupt(int irq, void *d, struct pt_regs *regs) +static irqreturn_t dt3k_interrupt(int irq, void *d, struct pt_regs *regs) { comedi_device *dev = d; comedi_subdevice *s = dev->subdevices + 0; @@ -358,6 +358,7 @@ static void dt3k_interrupt(int irq, void *d, struct pt_regs *regs) } comedi_event(dev,s,s->async->events); + return IRQ_HANDLED; } #ifdef DEBUG diff --git a/comedi/drivers/gsc_hpdi.c b/comedi/drivers/gsc_hpdi.c index 6e9aa8f7..ce681f16 100644 --- a/comedi/drivers/gsc_hpdi.c +++ b/comedi/drivers/gsc_hpdi.c @@ -58,7 +58,7 @@ void abort_dma( comedi_device *dev, unsigned int channel ); static int hpdi_cmd( comedi_device *dev, comedi_subdevice *s ); static int hpdi_cmd_test( comedi_device *dev, comedi_subdevice *s, comedi_cmd *cmd ); static int hpdi_cancel( comedi_device *dev, comedi_subdevice *s ); -static void handle_interrupt(int irq, void *d, struct pt_regs *regs); +static irqreturn_t handle_interrupt(int irq, void *d, struct pt_regs *regs); static int dio_config_block_size( comedi_device *dev, lsampl_t *data ); #undef HPDI_DEBUG // disable debugging messages @@ -895,7 +895,7 @@ static void drain_dma_buffers(comedi_device *dev, unsigned int channel) // XXX check for buffer overrun somehow } -static void handle_interrupt(int irq, void *d, struct pt_regs *regs) +static irqreturn_t handle_interrupt(int irq, void *d, struct pt_regs *regs) { comedi_device *dev = d; comedi_subdevice *s = dev->read_subdev; @@ -918,7 +918,7 @@ static void handle_interrupt(int irq, void *d, struct pt_regs *regs) writel( hpdi_intr_status, priv(dev)->hpdi_iobase + INTERRUPT_STATUS_REG ); }else if( ( plx_status & ( ICS_DMA0_A | ICS_DMA1_A | ICS_LIA ) ) == 0 ) { - return; + return IRQ_NONE; } // spin lock makes sure noone else changes plx dma control reg @@ -980,7 +980,7 @@ static void handle_interrupt(int irq, void *d, struct pt_regs *regs) cfc_handle_events( dev, s ); - return; + return IRQ_HANDLED; } void abort_dma( comedi_device *dev, unsigned int channel ) @@ -998,7 +998,7 @@ void abort_dma( comedi_device *dev, unsigned int channel ) static int hpdi_cancel( comedi_device *dev, comedi_subdevice *s ) { hpdi_writel( dev, 0, BOARD_CONTROL_REG ); - + writel( 0, priv(dev)->hpdi_iobase + INTERRUPT_CONTROL_REG ); abort_dma(dev, 0); diff --git a/comedi/drivers/icp_multi.c b/comedi/drivers/icp_multi.c index bd60c701..d6d52f09 100644 --- a/comedi/drivers/icp_multi.c +++ b/comedi/drivers/icp_multi.c @@ -601,24 +601,22 @@ static int icp_multi_insn_write_ctr(comedi_device * dev, comedi_subdevice * s, c void *d Pointer to current device struct pt_regs *regs Pointer to - Returns:int Nmuber of instructions executed - ============================================================================== */ -static void interrupt_service_icp_multi(int irq, void *d, struct pt_regs *regs) +static irqreturn_t interrupt_service_icp_multi(int irq, void *d, struct pt_regs *regs) { comedi_device *dev = d; int int_no; - + #ifdef ICP_MULTI_EXTDEBUG printk("icp multi EDBG: BGN: interrupt_service_icp_multi(%d,...)\n",irq); #endif // Is this interrupt from our board? int_no = readw(dev->iobase + ICP_MULTI_INT_STAT) & Status_IRQ; - if (!int_no) + if (!int_no) // No, exit - return; + return IRQ_NONE; #ifdef ICP_MULTI_EXTDEBUG printk("icp multi EDBG: interrupt_service_icp_multi() ST: %4x\n",readw(dev->iobase + ICP_MULTI_INT_STAT)); @@ -651,6 +649,7 @@ static void interrupt_service_icp_multi(int irq, void *d, struct pt_regs *regs) #ifdef ICP_MULTI_EXTDEBUG printk("icp multi EDBG: END: interrupt_service_icp_multi(...)\n"); #endif + return IRQ_HANDLED; } @@ -659,7 +658,7 @@ static void interrupt_service_icp_multi(int irq, void *d, struct pt_regs *regs) ============================================================================== Name: check_channel_list - + Description: This function checks if the channel list, provided by user is built correctly diff --git a/comedi/drivers/ni_6527.c b/comedi/drivers/ni_6527.c index 84b3f1d3..a2d9b7b6 100644 --- a/comedi/drivers/ni_6527.c +++ b/comedi/drivers/ni_6527.c @@ -197,21 +197,22 @@ static int ni6527_do_insn_bits(comedi_device *dev,comedi_subdevice *s, return 2; } -static void ni6527_interrupt(int irq, void *d, struct pt_regs *regs) +static irqreturn_t ni6527_interrupt(int irq, void *d, struct pt_regs *regs) { comedi_device *dev = d; comedi_subdevice *s = dev->subdevices + 2; unsigned int status; status = readb(dev->iobase + Change_Status); - if(!status&MasterInterruptStatus)return; - if(!status&EdgeStatus)return; + if(!status&MasterInterruptStatus)return IRQ_NONE; + if(!status&EdgeStatus)return IRQ_NONE; writeb(ClrEdge | ClrOverflow, dev->iobase + Clear_Register); comedi_buf_put(s->async, 0); s->async->events |= COMEDI_CB_EOS; comedi_event(dev,s,s->async->events); + return IRQ_HANDLED; } static int ni6527_intr_cmdtest(comedi_device *dev,comedi_subdevice *s, diff --git a/comedi/drivers/ni_at_a2150.c b/comedi/drivers/ni_at_a2150.c index 59ca720a..77559c1c 100644 --- a/comedi/drivers/ni_at_a2150.c +++ b/comedi/drivers/ni_at_a2150.c @@ -177,7 +177,7 @@ static comedi_driver driver_a2150={ detach: a2150_detach, }; -static void a2150_interrupt(int irq, void *d, struct pt_regs *regs); +static irqreturn_t a2150_interrupt(int irq, void *d, struct pt_regs *regs); static int a2150_ai_cmdtest(comedi_device *dev,comedi_subdevice *s,comedi_cmd *cmd); static int a2150_ai_cmd(comedi_device *dev, comedi_subdevice *s); static int a2150_ai_rinsn(comedi_device *dev, comedi_subdevice *s, comedi_insn *insn, lsampl_t *data); @@ -202,7 +202,7 @@ static void ni_dump_regs(comedi_device *dev) #endif /* interrupt service routine */ -static void a2150_interrupt(int irq, void *d, struct pt_regs *regs) +static irqreturn_t a2150_interrupt(int irq, void *d, struct pt_regs *regs) { int i; int status; @@ -218,7 +218,7 @@ static void a2150_interrupt(int irq, void *d, struct pt_regs *regs) if(dev->attached == 0) { comedi_error(dev, "premature interrupt"); - return; + return IRQ_HANDLED; } // initialize async here to make sure s is not NULL async = s->async; @@ -230,7 +230,7 @@ static void a2150_interrupt(int irq, void *d, struct pt_regs *regs) if((status & INTR_BIT ) == 0) { comedi_error(dev, "spurious interrupt"); - return; + return IRQ_NONE; } if(status & OVFL_BIT) @@ -246,7 +246,7 @@ static void a2150_interrupt(int irq, void *d, struct pt_regs *regs) a2150_cancel(dev, s); async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; comedi_event(dev, s, async->events); - return; + return IRQ_HANDLED; } flags = claim_dma_lock(); @@ -318,7 +318,7 @@ static void a2150_interrupt(int irq, void *d, struct pt_regs *regs) /* clear interrupt */ outw(0x00, dev->iobase + DMA_TC_CLEAR_REG); - return; + return IRQ_HANDLED; } // probes board type, returns offset diff --git a/comedi/drivers/ni_atmio16d.c b/comedi/drivers/ni_atmio16d.c index e3c17909..cd38a0a5 100644 --- a/comedi/drivers/ni_atmio16d.c +++ b/comedi/drivers/ni_atmio16d.c @@ -127,7 +127,7 @@ static atmio16_board_t atmio16_boards[]={ /* function prototypes */ static int atmio16d_attach(comedi_device *dev,comedi_devconfig *it); static int atmio16d_detach(comedi_device *dev); -static void atmio16d_interrupt(int irq, void *d, struct pt_regs *regs); +static irqreturn_t atmio16d_interrupt(int irq, void *d, struct pt_regs *regs); static int atmio16d_ai_cmdtest(comedi_device *dev, comedi_subdevice *s, comedi_cmd *cmd); static int atmio16d_ai_cmd(comedi_device *dev, comedi_subdevice *s); static int atmio16d_ai_cancel(comedi_device *dev, comedi_subdevice *s); @@ -254,16 +254,17 @@ static void reset_atmio16d(comedi_device *dev) outw(2048, dev->iobase+DAC1_REG); } -static void atmio16d_interrupt(int irq, void *d, struct pt_regs *regs) +static irqreturn_t atmio16d_interrupt(int irq, void *d, struct pt_regs *regs) { comedi_device *dev = d; comedi_subdevice *s = dev->subdevices + 0; - + // printk("atmio16d_interrupt!\n"); comedi_buf_put( s->async, inw(dev->iobase+AD_FIFO_REG) ); comedi_event(dev, s, s->async->events); + return IRQ_HANDLED; } static int atmio16d_ai_cmdtest(comedi_device *dev, comedi_subdevice *s, comedi_cmd *cmd) diff --git a/comedi/drivers/ni_daq_dio24.c b/comedi/drivers/ni_daq_dio24.c index cc6d0220..ba86f0de 100644 --- a/comedi/drivers/ni_daq_dio24.c +++ b/comedi/drivers/ni_daq_dio24.c @@ -304,7 +304,7 @@ typedef struct local_info_t { /*====================================================================*/ -static void cs_error(client_handle_t handle, int func, int ret) +static void my_cs_error(client_handle_t handle, int func, int ret) { error_info_t err = { func, ret }; CardServices(ReportError, handle, &err); @@ -378,7 +378,7 @@ static dev_link_t *dio24_cs_attach(void) client_reg.event_callback_args.client_data = link; ret = CardServices(RegisterClient, &link->handle, &client_reg); if (ret != CS_SUCCESS) { - cs_error(link->handle, RegisterClient, ret); + my_cs_error(link->handle, RegisterClient, ret); dio24_cs_detach(link); return NULL; } @@ -640,7 +640,7 @@ static void dio24_config(dev_link_t *link) return; cs_failed: - cs_error(link->handle, last_fn, last_ret); + my_cs_error(link->handle, last_fn, last_ret); printk(KERN_INFO "Fallo"); dio24_release((u_long)link); diff --git a/comedi/drivers/ni_labpc.c b/comedi/drivers/ni_labpc.c index 5e07e586..7546596f 100644 --- a/comedi/drivers/ni_labpc.c +++ b/comedi/drivers/ni_labpc.c @@ -163,7 +163,7 @@ NI manuals: static int labpc_attach(comedi_device *dev,comedi_devconfig *it); static int labpc_cancel(comedi_device *dev, comedi_subdevice *s); -static void labpc_interrupt(int irq, void *d, struct pt_regs *regs); +static irqreturn_t labpc_interrupt(int irq, void *d, struct pt_regs *regs); static int labpc_drain_fifo(comedi_device *dev); static void labpc_drain_dma(comedi_device *dev); static void handle_isa_dma(comedi_device *dev); @@ -1316,7 +1316,7 @@ static int labpc_ai_cmd(comedi_device *dev, comedi_subdevice *s) } /* interrupt service routine */ -static void labpc_interrupt(int irq, void *d, struct pt_regs *regs) +static irqreturn_t labpc_interrupt(int irq, void *d, struct pt_regs *regs) { comedi_device *dev = d; comedi_subdevice *s = dev->read_subdev; @@ -1326,7 +1326,7 @@ static void labpc_interrupt(int irq, void *d, struct pt_regs *regs) if(dev->attached == 0) { comedi_error(dev, "premature interrupt"); - return; + return IRQ_HANDLED; } async = s->async; @@ -1342,7 +1342,7 @@ static void labpc_interrupt(int irq, void *d, struct pt_regs *regs) (devpriv->status2_bits & A1_TC_BIT) == 0 && (devpriv->status2_bits & FNHF_BIT)) { - return; + return IRQ_NONE; } if(devpriv->status1_bits & OVERRUN_BIT) @@ -1352,7 +1352,7 @@ static void labpc_interrupt(int irq, void *d, struct pt_regs *regs) async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; comedi_event(dev, s, async->events); comedi_error(dev, "overrun"); - return; + return IRQ_HANDLED; } if(devpriv->current_transfer == isa_dma_transfer) @@ -1378,7 +1378,7 @@ static void labpc_interrupt(int irq, void *d, struct pt_regs *regs) thisboard->write_byte(0x1, dev->iobase + ADC_CLEAR_REG); async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; comedi_error(dev, "overflow"); - return; + return IRQ_HANDLED; } // handle external stop trigger @@ -1403,6 +1403,7 @@ static void labpc_interrupt(int irq, void *d, struct pt_regs *regs) } comedi_event(dev, s, async->events); + return IRQ_HANDLED; } // read all available samples from ai fifo diff --git a/comedi/drivers/ni_labpc_cs.c b/comedi/drivers/ni_labpc_cs.c index 7e9adf50..509a0ba3 100644 --- a/comedi/drivers/ni_labpc_cs.c +++ b/comedi/drivers/ni_labpc_cs.c @@ -247,7 +247,7 @@ typedef struct local_info_t { /*====================================================================*/ -static void cs_error(client_handle_t handle, int func, int ret) +static void my_cs_error(client_handle_t handle, int func, int ret) { error_info_t err = { func, ret }; CardServices(ReportError, handle, &err); @@ -318,7 +318,7 @@ static dev_link_t *labpc_cs_attach(void) client_reg.event_callback_args.client_data = link; ret = CardServices(RegisterClient, &link->handle, &client_reg); if (ret != CS_SUCCESS) { - cs_error(link->handle, RegisterClient, ret); + my_cs_error(link->handle, RegisterClient, ret); labpc_cs_detach(link); return NULL; } @@ -572,7 +572,7 @@ static void labpc_config(dev_link_t *link) return; cs_failed: - cs_error(link->handle, last_fn, last_ret); + my_cs_error(link->handle, last_fn, last_ret); labpc_release((u_long)link); } /* labpc_config */ diff --git a/comedi/drivers/ni_mio_common.c b/comedi/drivers/ni_mio_common.c index ecb5c774..6411bd9b 100644 --- a/comedi/drivers/ni_mio_common.c +++ b/comedi/drivers/ni_mio_common.c @@ -303,7 +303,7 @@ static inline void ni_set_bits(comedi_device *dev, int reg, int bits, int value) } -static void ni_E_interrupt(int irq,void *d,struct pt_regs * regs) +static irqreturn_t ni_E_interrupt(int irq,void *d,struct pt_regs * regs) { comedi_device *dev=d; unsigned short a_status; @@ -328,6 +328,7 @@ static void ni_E_interrupt(int irq,void *d,struct pt_regs * regs) handle_a_interrupt(dev, a_status, m0_status); if(b_status&Interrupt_B_St || m1_status & CHSR_INT ) handle_b_interrupt(dev, b_status, m1_status); + return IRQ_HANDLED; } #ifdef PCIDMA diff --git a/comedi/drivers/ni_mio_cs.c b/comedi/drivers/ni_mio_cs.c index a145219e..46a06419 100644 --- a/comedi/drivers/ni_mio_cs.c +++ b/comedi/drivers/ni_mio_cs.c @@ -273,11 +273,11 @@ static dev_node_t dev_node = { }; static int mio_cs_event(event_t event, int priority, event_callback_args_t *args); -static void cs_error(client_handle_t handle, int func, int ret) +static void my_cs_error(client_handle_t handle, int func, int ret) { error_info_t err = { func, ret }; - DPRINTK("cs_error(handle=%p, func=%d, ret=%d)\n",handle,func,ret); + DPRINTK("my_cs_error(handle=%p, func=%d, ret=%d)\n",handle,func,ret); CardServices(ReportError, handle, &err); } @@ -318,7 +318,7 @@ static dev_link_t *cs_attach(void) client_reg.event_callback_args.client_data = link; ret = CardServices(RegisterClient, &link->handle, &client_reg); if (ret != CS_SUCCESS) { - cs_error(link->handle, RegisterClient, ret); + my_cs_error(link->handle, RegisterClient, ret); printk("detaching...\n"); cs_detach(link); return NULL; diff --git a/comedi/drivers/ni_pcidio.c b/comedi/drivers/ni_pcidio.c index 582c8466..c01b5963 100644 --- a/comedi/drivers/ni_pcidio.c +++ b/comedi/drivers/ni_pcidio.c @@ -384,7 +384,7 @@ static int nidio96_8255_cb(int dir,int port,int data,unsigned long iobase) } } -static void nidio_interrupt(int irq, void *d, struct pt_regs *regs) +static irqreturn_t nidio_interrupt(int irq, void *d, struct pt_regs *regs) { comedi_device *dev=d; comedi_subdevice *s = dev->subdevices; @@ -399,6 +399,7 @@ static void nidio_interrupt(int irq, void *d, struct pt_regs *regs) int status; int work = 0; unsigned int m_status; + int retval = IRQ_HANDLED; status = readb(dev->iobase+Interrupt_And_Window_Status); flags = readb(dev->iobase+Group_1_Flags); @@ -541,13 +542,13 @@ static void nidio_interrupt(int irq, void *d, struct pt_regs *regs) out: comedi_event(dev,s,async->events); - + #if unused if(!tag){ writeb(0x03,dev->iobase+Master_DMA_And_Interrupt_Control); } #endif - + return IRQ_RETVAL(retval); } #ifdef DEBUG_FLAGS diff --git a/comedi/drivers/pcl711.c b/comedi/drivers/pcl711.c index a67a2351..a8e91316 100644 --- a/comedi/drivers/pcl711.c +++ b/comedi/drivers/pcl711.c @@ -181,7 +181,7 @@ typedef struct { #define devpriv ((pcl711_private *)dev->private) -static void pcl711_interrupt(int irq, void *d, struct pt_regs *regs) +static irqreturn_t pcl711_interrupt(int irq, void *d, struct pt_regs *regs) { int lo, hi; int data; @@ -204,6 +204,7 @@ static void pcl711_interrupt(int irq, void *d, struct pt_regs *regs) s->async->events |= COMEDI_CB_EOA; } comedi_event(dev, s, s->async->events); + return IRQ_HANDLED; } static void pcl711_set_changain(comedi_device * dev, int chan) diff --git a/comedi/drivers/pcl812.c b/comedi/drivers/pcl812.c index 25a650e0..11df8c7d 100644 --- a/comedi/drivers/pcl812.c +++ b/comedi/drivers/pcl812.c @@ -848,7 +848,7 @@ static int pcl812_ai_cmd(comedi_device *dev,comedi_subdevice *s) /* ============================================================================== */ -static void interrupt_pcl812_ai_int(int irq, void *d, struct pt_regs *regs) +static irqreturn_t interrupt_pcl812_ai_int(int irq, void *d, struct pt_regs *regs) { char err=1; unsigned int mask, timeout; @@ -875,13 +875,13 @@ static void interrupt_pcl812_ai_int(int irq, void *d, struct pt_regs *regs) comedi_udelay(1); } } - + if (err) { rt_printk("comedi%d: pcl812: (%s at 0x%x) A/D cmd IRQ without DRDY!\n", dev->minor, dev->board_name, dev->iobase); pcl812_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA|COMEDI_CB_ERROR; comedi_event(dev,s,s->async->events); - return; + return IRQ_HANDLED; } comedi_buf_put( s->async, @@ -899,9 +899,10 @@ static void interrupt_pcl812_ai_int(int irq, void *d, struct pt_regs *regs) } comedi_event(dev,s,s->async->events); + return IRQ_HANDLED; } -/* +/* ============================================================================== */ static void transfer_from_dma_buf(comedi_device *dev,comedi_subdevice *s, @@ -930,38 +931,38 @@ static void transfer_from_dma_buf(comedi_device *dev,comedi_subdevice *s, /* ============================================================================== */ -static void interrupt_pcl812_ai_dma(int irq, void *d, struct pt_regs *regs) +static irqreturn_t interrupt_pcl812_ai_dma(int irq, void *d, struct pt_regs *regs) { comedi_device *dev = d; comedi_subdevice *s = dev->subdevices + 0; unsigned long dma_flags; int len,bufptr; - sampl_t *ptr; + sampl_t *ptr; #ifdef PCL812_EXTDEBUG rt_printk("pcl812 EDBG: BGN: interrupt_pcl812_ai_dma(...)\n"); #endif - ptr=(sampl_t *)devpriv->dmabuf[devpriv->next_dma_buf]; - len=(devpriv->dmabytestomove[devpriv->next_dma_buf] >> 1) - devpriv->ai_poll_ptr; + ptr=(sampl_t *)devpriv->dmabuf[devpriv->next_dma_buf]; + len=(devpriv->dmabytestomove[devpriv->next_dma_buf] >> 1) - devpriv->ai_poll_ptr; - devpriv->next_dma_buf=1-devpriv->next_dma_buf; - disable_dma(devpriv->dma); + devpriv->next_dma_buf=1-devpriv->next_dma_buf; + disable_dma(devpriv->dma); set_dma_mode(devpriv->dma, DMA_MODE_READ); dma_flags=claim_dma_lock(); set_dma_addr(devpriv->dma, devpriv->hwdmaptr[devpriv->next_dma_buf]); if (devpriv->ai_eos) { - set_dma_count(devpriv->dma, devpriv->dmabytestomove[devpriv->next_dma_buf]); + set_dma_count(devpriv->dma, devpriv->dmabytestomove[devpriv->next_dma_buf]); } else { if (devpriv->dma_runs_to_end) { set_dma_count(devpriv->dma, devpriv->dmabytestomove[devpriv->next_dma_buf]); } - else { set_dma_count(devpriv->dma, devpriv->last_dma_run); } - devpriv->dma_runs_to_end--; + else { set_dma_count(devpriv->dma, devpriv->last_dma_run); } + devpriv->dma_runs_to_end--; } release_dma_lock(dma_flags); enable_dma(devpriv->dma); - outb(0,dev->iobase+PCL812_CLRINT); /* clear INT request */ + outb(0,dev->iobase+PCL812_CLRINT); /* clear INT request */ - bufptr=devpriv->ai_poll_ptr; + bufptr=devpriv->ai_poll_ptr; devpriv->ai_poll_ptr=0; transfer_from_dma_buf(dev, s, ptr, bufptr, len); @@ -969,18 +970,18 @@ static void interrupt_pcl812_ai_dma(int irq, void *d, struct pt_regs *regs) #ifdef PCL812_EXTDEBUG rt_printk("pcl812 EDBG: END: interrupt_pcl812_ai_dma(...)\n"); #endif + return IRQ_HANDLED; } -/* +/* ============================================================================== */ -static void interrupt_pcl812(int irq, void *d, struct pt_regs *regs) +static irqreturn_t interrupt_pcl812(int irq, void *d, struct pt_regs *regs) { comedi_device *dev = d; - if (devpriv->ai_dma) { interrupt_pcl812_ai_dma(irq, d, regs); } - else { interrupt_pcl812_ai_int(irq, d, regs); }; - + if (devpriv->ai_dma) { return interrupt_pcl812_ai_dma(irq, d, regs); } + else { return interrupt_pcl812_ai_int(irq, d, regs); }; } /* diff --git a/comedi/drivers/pcl816.c b/comedi/drivers/pcl816.c index f3d5b9ad..d25249a7 100644 --- a/comedi/drivers/pcl816.c +++ b/comedi/drivers/pcl816.c @@ -272,56 +272,56 @@ static int pcl816_ai_insn_read(comedi_device *dev, comedi_subdevice *s, analog input interrupt mode 1 & 3, 818 cards one sample per interrupt version */ -static void +static irqreturn_t interrupt_pcl816_ai_mode13_int (int irq, void *d, struct pt_regs *regs) { - comedi_device *dev = d; - comedi_subdevice *s = dev->subdevices + 0; - int low, hi; - int timeout = 50; /* wait max 50us */ + comedi_device *dev = d; + comedi_subdevice *s = dev->subdevices + 0; + int low, hi; + int timeout = 50; /* wait max 50us */ - while (timeout--) { - if (!(inb (dev->iobase + PCL816_STATUS) & PCL816_STATUS_DRDY_MASK)) + while (timeout--) { + if (!(inb (dev->iobase + PCL816_STATUS) & PCL816_STATUS_DRDY_MASK)) break; comedi_udelay (1); } if(!timeout) { // timeout, bail error - outb (0, dev->iobase + PCL816_CLRINT); /* clear INT request */ - comedi_error (dev, "A/D mode1/3 IRQ without DRDY!"); - pcl816_ai_cancel (dev, s); - s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; - comedi_event(dev, s, s->async->events); - return; + outb (0, dev->iobase + PCL816_CLRINT); /* clear INT request */ + comedi_error (dev, "A/D mode1/3 IRQ without DRDY!"); + pcl816_ai_cancel (dev, s); + s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; + comedi_event(dev, s, s->async->events); + return IRQ_HANDLED; } - // get the sample - low = inb (dev->iobase + PCL816_AD_LO); - hi = inb (dev->iobase + PCL816_AD_HI); + // get the sample + low = inb (dev->iobase + PCL816_AD_LO); + hi = inb (dev->iobase + PCL816_AD_HI); - comedi_buf_put( s->async, (hi << 8)|low ); + comedi_buf_put( s->async, (hi << 8)|low ); - outb (0, dev->iobase + PCL816_CLRINT); /* clear INT request */ + outb (0, dev->iobase + PCL816_CLRINT); /* clear INT request */ - if (++devpriv->ai_act_chanlist_pos >= devpriv->ai_act_chanlist_len) - devpriv->ai_act_chanlist_pos = 0; + if (++devpriv->ai_act_chanlist_pos >= devpriv->ai_act_chanlist_len) + devpriv->ai_act_chanlist_pos = 0; - if (s->async->cur_chan == 0){ + if (s->async->cur_chan == 0){ devpriv->ai_act_scan++; - } + } - if (!devpriv->ai_neverending) + if (!devpriv->ai_neverending) if (devpriv->ai_act_scan >= devpriv->ai_scans) { /* all data sampled */ /* all data sampled */ pcl816_ai_cancel (dev, s); s->async->events |= COMEDI_CB_EOA; - return; } comedi_event(dev, s, s->async->events); + return IRQ_HANDLED; } /* @@ -358,7 +358,7 @@ static void transfer_from_dma_buf(comedi_device *dev,comedi_subdevice *s, } -static void interrupt_pcl816_ai_mode13_dma(int irq, void *d, struct pt_regs *regs) +static irqreturn_t interrupt_pcl816_ai_mode13_dma(int irq, void *d, struct pt_regs *regs) { comedi_device *dev = d; comedi_subdevice *s = dev->subdevices + 0; @@ -396,6 +396,7 @@ static void interrupt_pcl816_ai_mode13_dma(int irq, void *d, struct pt_regs *reg devpriv->ai_poll_ptr = 0; transfer_from_dma_buf(dev, s, ptr, bufptr, len); + return IRQ_HANDLED; } @@ -403,7 +404,7 @@ static void interrupt_pcl816_ai_mode13_dma(int irq, void *d, struct pt_regs *reg ============================================================================== INT procedure */ -static void +static irqreturn_t interrupt_pcl816 (int irq, void *d, struct pt_regs *regs) { comedi_device *dev = d; @@ -411,19 +412,17 @@ interrupt_pcl816 (int irq, void *d, struct pt_regs *regs) if(!dev->attached) { comedi_error(dev, "premature interrupt"); - return; + return IRQ_HANDLED; } switch (devpriv->int816_mode) { case INT_TYPE_AI1_DMA: case INT_TYPE_AI3_DMA: - interrupt_pcl816_ai_mode13_dma (irq, d, regs); - return; + return interrupt_pcl816_ai_mode13_dma (irq, d, regs); case INT_TYPE_AI1_INT: case INT_TYPE_AI3_INT: - interrupt_pcl816_ai_mode13_int (irq, d, regs); - return; + return interrupt_pcl816_ai_mode13_int (irq, d, regs); } @@ -434,12 +433,13 @@ interrupt_pcl816 (int irq, void *d, struct pt_regs *regs) if (devpriv->irq_was_now_closed) { devpriv->irq_was_now_closed = 0; // comedi_error(dev,"last IRQ.."); - return; + return IRQ_HANDLED; } comedi_error (dev, "bad IRQ!"); - return; + return IRQ_NONE; } comedi_error (dev, "IRQ from unknow source!"); + return IRQ_NONE; } diff --git a/comedi/drivers/pcl818.c b/comedi/drivers/pcl818.c index 721da76c..780be2ca 100644 --- a/comedi/drivers/pcl818.c +++ b/comedi/drivers/pcl818.c @@ -483,25 +483,25 @@ static int pcl818_do_insn_bits(comedi_device *dev, comedi_subdevice *s, /* ============================================================================== analog input interrupt mode 1 & 3, 818 cards - one sample per interrupt version + one sample per interrupt version */ -static void interrupt_pcl818_ai_mode13_int(int irq, void *d, struct pt_regs *regs) +static irqreturn_t interrupt_pcl818_ai_mode13_int(int irq, void *d, struct pt_regs *regs) { - comedi_device *dev = d; + comedi_device *dev = d; comedi_subdevice *s = dev->subdevices + 0; - int low; - int timeout=50; /* wait max 50us */ + int low; + int timeout=50; /* wait max 50us */ while (timeout--) { if (inb(dev->iobase + PCL818_STATUS) & 0x10) goto conv_finish; comedi_udelay(1); - } - outb(0,dev->iobase+PCL818_STATUS); /* clear INT request */ - comedi_error(dev,"A/D mode1/3 IRQ without DRDY!"); + } + outb(0,dev->iobase+PCL818_STATUS); /* clear INT request */ + comedi_error(dev,"A/D mode1/3 IRQ without DRDY!"); pcl818_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; comedi_event(dev, s, s->async->events); - return; + return IRQ_HANDLED; conv_finish: low=inb(dev->iobase + PCL818_AD_LO); @@ -509,43 +509,43 @@ conv_finish: ((inb(dev->iobase + PCL818_AD_HI) << 4) | (low >> 4)) ); // get one sample outb(0,dev->iobase+PCL818_CLRINT); /* clear INT request */ - if ((low & 0xf)!=devpriv->act_chanlist[devpriv->act_chanlist_pos]) { // dropout! + if ((low & 0xf)!=devpriv->act_chanlist[devpriv->act_chanlist_pos]) { // dropout! rt_printk("comedi: A/D mode1/3 IRQ - channel dropout %x!=%x !\n",(low & 0xf),devpriv->act_chanlist[devpriv->act_chanlist_pos]); pcl818_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; comedi_event(dev, s, s->async->events); - return; - } - if (s->async->cur_chan == 0) { + return IRQ_HANDLED; + } + if (s->async->cur_chan == 0) { // rt_printk("E"); devpriv->int13_act_scan--; - } + } if (!devpriv->neverending_ai){ if ( devpriv->int13_act_scan == 0 ) { /* all data sampled */ pcl818_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA; - return; } } comedi_event(dev, s, s->async->events); + return IRQ_HANDLED; } /* ============================================================================== analog input dma mode 1 & 3, 818 cards */ -static void interrupt_pcl818_ai_mode13_dma(int irq, void *d, struct pt_regs *regs) +static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, void *d, struct pt_regs *regs) { comedi_device *dev = d; comedi_subdevice *s = dev->subdevices + 0; int i,len,bufptr; unsigned long flags; - sampl_t *ptr; + sampl_t *ptr; - disable_dma(devpriv->dma); - devpriv->next_dma_buf=1-devpriv->next_dma_buf; - if ((devpriv->dma_runs_to_end)>-1) { // switch dma bufs + disable_dma(devpriv->dma); + devpriv->next_dma_buf=1-devpriv->next_dma_buf; + if ((devpriv->dma_runs_to_end)>-1) { // switch dma bufs set_dma_mode(devpriv->dma, DMA_MODE_READ); flags=claim_dma_lock(); set_dma_addr(devpriv->dma, devpriv->hwdmaptr[devpriv->next_dma_buf]); @@ -553,22 +553,22 @@ static void interrupt_pcl818_ai_mode13_dma(int irq, void *d, struct pt_regs *reg else { set_dma_count(devpriv->dma, devpriv->last_dma_run); } release_dma_lock(flags); enable_dma(devpriv->dma); - } + } - devpriv->dma_runs_to_end--; - outb(0,dev->iobase+PCL818_CLRINT); /* clear INT request */ - ptr=(sampl_t *)devpriv->dmabuf[1-devpriv->next_dma_buf]; + devpriv->dma_runs_to_end--; + outb(0,dev->iobase+PCL818_CLRINT); /* clear INT request */ + ptr=(sampl_t *)devpriv->dmabuf[1-devpriv->next_dma_buf]; - len=devpriv->hwdmasize[0] >> 1; - bufptr=0; + len=devpriv->hwdmasize[0] >> 1; + bufptr=0; - for (i=0;iact_chanlist[devpriv->act_chanlist_pos]) { // dropout! - rt_printk("comedi: A/D mode1/3 DMA - channel dropout %d!=%d !\n",(ptr[bufptr] & 0xf),devpriv->act_chanlist[devpriv->act_chanlist_pos]); - pcl818_ai_cancel(dev,s); + rt_printk("comedi: A/D mode1/3 DMA - channel dropout %d!=%d !\n",(ptr[bufptr] & 0xf),devpriv->act_chanlist[devpriv->act_chanlist_pos]); + pcl818_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; comedi_event(dev, s, s->async->events); - return; + return IRQ_HANDLED; } comedi_buf_put( s->async, ptr[bufptr++] >> 4 ); // get one sample @@ -581,28 +581,29 @@ static void interrupt_pcl818_ai_mode13_dma(int irq, void *d, struct pt_regs *reg s->async->events |= COMEDI_CB_EOA; comedi_event(dev, s, s->async->events); // printk("done int ai13 dma\n"); - return; + return IRQ_HANDLED; } } if (len>0) comedi_event(dev, s, s->async->events); + return IRQ_HANDLED; } /* ============================================================================== analog input dma mode 1 & 3 over RTC, 818 cards */ -static void interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d, struct pt_regs *regs) +static irqreturn_t interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d, struct pt_regs *regs) { - comedi_device *dev = d; + comedi_device *dev = d; comedi_subdevice *s = dev->subdevices + 0; - unsigned long tmp; - unsigned int top1,top2,i,bufptr; - long ofs_dats; - sampl_t *dmabuf=(sampl_t *)devpriv->dmabuf[0]; + unsigned long tmp; + unsigned int top1,top2,i,bufptr; + long ofs_dats; + sampl_t *dmabuf=(sampl_t *)devpriv->dmabuf[0]; - //outb(2,0x378); - switch(devpriv->int818_mode) { + //outb(2,0x378); + switch(devpriv->int818_mode) { case INT_TYPE_AI1_DMA_RTC: case INT_TYPE_AI3_DMA_RTC: tmp = (CMOS_READ(RTC_INTR_FLAGS) & 0xF0); @@ -614,12 +615,12 @@ static void interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d, struct pt_regs if (top1==top2) break; } - if (top1!=top2) return; + if (top1!=top2) return IRQ_HANDLED; top1=devpriv->hwdmasize[0]-top1; // where is now DMA in buffer top1>>=1; ofs_dats=top1-devpriv->last_top_dma; // new samples from last call if (ofs_dats<0) ofs_dats=(devpriv->dmasamplsize)+ofs_dats; - if (!ofs_dats) return; // exit=no new samples from last call + if (!ofs_dats) return IRQ_HANDLED; // exit=no new samples from last call // obsluz data i=devpriv->last_top_dma-1; i&=(devpriv->dmasamplsize-1); @@ -630,7 +631,7 @@ static void interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d, struct pt_regs pcl818_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; comedi_event(dev, s, s->async->events); - return; + return IRQ_HANDLED; } //rt_printk("r %ld ",ofs_dats); @@ -642,7 +643,7 @@ static void interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d, struct pt_regs pcl818_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; comedi_event(dev, s, s->async->events); - return; + return IRQ_HANDLED; } comedi_buf_put( s->async, dmabuf[bufptr++] >> 4); // get one sample @@ -658,7 +659,7 @@ static void interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d, struct pt_regs s->async->events |= COMEDI_CB_EOA; comedi_event(dev, s, s->async->events); //printk("done int ai13 dma\n"); - return; + return IRQ_HANDLED; } } @@ -668,53 +669,54 @@ static void interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d, struct pt_regs dmabuf[bufptr]=MAGIC_DMA_WORD; comedi_event(dev, s, s->async->events); //outb(0,0x378); - return; + return IRQ_HANDLED; } //outb(0,0x378); + return IRQ_HANDLED; } /* ============================================================================== analog input interrupt mode 1 & 3, 818HD/HG cards */ -static void interrupt_pcl818_ai_mode13_fifo(int irq, void *d, struct pt_regs *regs) +static irqreturn_t interrupt_pcl818_ai_mode13_fifo(int irq, void *d, struct pt_regs *regs) { - comedi_device *dev = d; - comedi_subdevice *s = dev->subdevices + 0; - int i,len,lo; + comedi_device *dev = d; + comedi_subdevice *s = dev->subdevices + 0; + int i,len,lo; - outb(0, dev->iobase + PCL818_FI_INTCLR); // clear fifo int request + outb(0, dev->iobase + PCL818_FI_INTCLR); // clear fifo int request - lo=inb(dev->iobase + PCL818_FI_STATUS); + lo=inb(dev->iobase + PCL818_FI_STATUS); - if (lo&4) { + if (lo&4) { comedi_error(dev,"A/D mode1/3 FIFO overflow!"); pcl818_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; comedi_event(dev, s, s->async->events); - return; - } + return IRQ_HANDLED; + } - if (lo&1) { + if (lo&1) { comedi_error(dev,"A/D mode1/3 FIFO interrupt without data!"); pcl818_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; comedi_event(dev, s, s->async->events); - return; + return IRQ_HANDLED; } - if (lo&2) { len=512; } - else { len=0; } + if (lo&2) { len=512; } + else { len=0; } - for (i=0;iiobase + PCL818_FI_DATALO); if ((lo & 0xf)!=devpriv->act_chanlist[devpriv->act_chanlist_pos]) { // dropout! rt_printk("comedi: A/D mode1/3 FIFO - channel dropout %d!=%d !\n",(lo & 0xf),devpriv->act_chanlist[devpriv->act_chanlist_pos]); pcl818_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR; comedi_event(dev, s, s->async->events); - return; + return IRQ_HANDLED; } comedi_buf_put( s->async, (lo >> 4)|(inb(dev->iobase + PCL818_FI_DATAHI) << 4) ); // get one sample @@ -728,63 +730,63 @@ static void interrupt_pcl818_ai_mode13_fifo(int irq, void *d, struct pt_regs *re pcl818_ai_cancel(dev,s); s->async->events |= COMEDI_CB_EOA; comedi_event(dev, s, s->async->events); - return; + return IRQ_HANDLED; } } if (len>0) comedi_event(dev, s, s->async->events); + return IRQ_HANDLED; } /* ============================================================================== INT procedure */ -static void interrupt_pcl818(int irq, void *d, struct pt_regs *regs) +static irqreturn_t interrupt_pcl818(int irq, void *d, struct pt_regs *regs) { - comedi_device *dev = d; + comedi_device *dev = d; if(!dev->attached) { comedi_error(dev, "premature interrupt"); - return; + return IRQ_HANDLED; } - //rt_printk("I\n"); + //rt_printk("I\n"); - switch (devpriv->int818_mode) { + switch (devpriv->int818_mode) { case INT_TYPE_AI1_DMA: case INT_TYPE_AI3_DMA: - interrupt_pcl818_ai_mode13_dma(irq, d, regs); - return; + return interrupt_pcl818_ai_mode13_dma(irq, d, regs); case INT_TYPE_AI1_INT: case INT_TYPE_AI3_INT: - interrupt_pcl818_ai_mode13_int(irq, d, regs); - return; + return interrupt_pcl818_ai_mode13_int(irq, d, regs); case INT_TYPE_AI1_FIFO: case INT_TYPE_AI3_FIFO: - interrupt_pcl818_ai_mode13_fifo(irq, d, regs); - return; + return interrupt_pcl818_ai_mode13_fifo(irq, d, regs); #ifdef PCL818_MODE13_AO case INT_TYPE_AO1_INT: case INT_TYPE_AO3_INT: - interrupt_pcl818_ao_mode13_int(irq, d, regs); - return; + return interrupt_pcl818_ao_mode13_int(irq, d, regs); #endif + default: + break; } outb(0,dev->iobase+PCL818_CLRINT); /* clear INT request */ - if ((!dev->irq)|(!devpriv->irq_free)|(!devpriv->irq_blocked)|(!devpriv->int818_mode)) { + if ((!dev->irq)||(!devpriv->irq_free)||(!devpriv->irq_blocked)||(!devpriv->int818_mode)) { if (devpriv->irq_was_now_closed) { devpriv->irq_was_now_closed=0; // comedi_error(dev,"last IRQ.."); - return; + return IRQ_HANDLED; } comedi_error(dev,"bad IRQ!"); - return; + return IRQ_NONE; } - comedi_error(dev,"IRQ from unknow source!"); + comedi_error(dev,"IRQ from unknow source!"); + return IRQ_NONE; } /* diff --git a/comedi/drivers/quatech_daqp_cs.c b/comedi/drivers/quatech_daqp_cs.c index b757f94c..7b0b6abe 100644 --- a/comedi/drivers/quatech_daqp_cs.c +++ b/comedi/drivers/quatech_daqp_cs.c @@ -480,7 +480,7 @@ static dev_info_t dev_info = "daqp_cs"; /*====================================================================*/ -static void cs_error(client_handle_t handle, int func, int ret) +static void my_cs_error(client_handle_t handle, int func, int ret) { error_info_t err = { func, ret }; CardServices(ReportError, handle, &err); @@ -564,7 +564,7 @@ static dev_link_t *daqp_cs_attach(void) client_reg.event_callback_args.client_data = link; ret = CardServices(RegisterClient, &link->handle, &client_reg); if (ret != CS_SUCCESS) { - cs_error(link->handle, RegisterClient, ret); + my_cs_error(link->handle, RegisterClient, ret); daqp_cs_detach(link); return NULL; } @@ -777,7 +777,7 @@ static void daqp_cs_config(dev_link_t *link) return; cs_failed: - cs_error(link->handle, last_fn, last_ret); + my_cs_error(link->handle, last_fn, last_ret); daqp_cs_release((u_long)link); } /* daqp_cs_config */ diff --git a/comedi/drivers/rtd520.c b/comedi/drivers/rtd520.c index 56b0352f..83b800e9 100644 --- a/comedi/drivers/rtd520.c +++ b/comedi/drivers/rtd520.c @@ -733,7 +733,7 @@ static int rtd_ai_cmd ( comedi_device *dev, comedi_subdevice *s); static int rtd_ai_cancel ( comedi_device *dev, comedi_subdevice *s); //static int rtd_ai_poll (comedi_device *dev,comedi_subdevice *s); static int rtd_ns_to_timer (unsigned int *ns, int roundMode); -static void rtd_interrupt ( int irq, void *d, struct pt_regs *regs); +static irqreturn_t rtd_interrupt ( int irq, void *d, struct pt_regs *regs); /* @@ -1472,30 +1472,30 @@ static int ai_process_dma ( #endif /* USE_DMA */ /* - Handle all rtd520 interrupts. + Handle all rtd520 interrupts. Runs atomically and is never re-entered. This is a "slow handler"; other interrupts may be active. The data conversion may someday happen in a "bottom half". */ -static void rtd_interrupt ( +static irqreturn_t rtd_interrupt ( int irq, /* interrupt number (ignored) */ void *d, /* our data */ struct pt_regs *regs) /* cpu context (ignored) */ { - comedi_device *dev = d; /* must be called "dev" for devpriv */ - u16 status; - u16 fifoStatus; - comedi_subdevice *s = dev->subdevices + 0; /* analog in subdevice */ + comedi_device *dev = d; /* must be called "dev" for devpriv */ + u16 status; + u16 fifoStatus; + comedi_subdevice *s = dev->subdevices + 0; /* analog in subdevice */ - devpriv->intCount++; /* DEBUG statistics */ + devpriv->intCount++; /* DEBUG statistics */ - fifoStatus = RtdFifoStatus (dev); - /* check for FIFO full, this automatically halts the ADC! */ - if (!(fifoStatus & FS_ADC_FULL)) { /* 0 -> full */ - DPRINTK("rtd520: FIFO full! fifo_status=0x%x\n", - (fifoStatus ^ 0x6666) & 0x7777); /* should be all 0s */ - goto abortTransfer; - } + fifoStatus = RtdFifoStatus (dev); + /* check for FIFO full, this automatically halts the ADC! */ + if (!(fifoStatus & FS_ADC_FULL)) { /* 0 -> full */ + DPRINTK("rtd520: FIFO full! fifo_status=0x%x\n", + (fifoStatus ^ 0x6666) & 0x7777); /* should be all 0s */ + goto abortTransfer; + } #ifdef USE_DMA if (devpriv->flags & DMA0_ACTIVE) { /* Check DMA */ @@ -1510,7 +1510,7 @@ static void rtd_interrupt ( | PLX_CLEAR_DMA_INTR_BIT); goto abortTransfer; } - + /*DPRINTK ("rtd520: DMA transfer: %ld to go, istatus %x\n", devpriv->aiCount, istatus);*/ RtdDma0Control (dev, (devpriv->dma0Control & ~PLX_DMA_START_BIT) @@ -1530,7 +1530,7 @@ static void rtd_interrupt ( status = RtdInterruptStatus (dev); /* if interrupt was not caused by our board, or handled above */ if (0 == status) { - return; + return IRQ_HANDLED; } if (status & IRQM_ADC_ABOUT_CNT) { /* sample count -> read FIFO */ @@ -1581,12 +1581,12 @@ static void rtd_interrupt ( devpriv->aiCount, 0xffff & RtdInterruptOverrunStatus (dev)); goto abortTransfer; - } - + } + /* clear the interrupt */ RtdInterruptClearMask (dev, status); RtdInterruptClear (dev); - return; + return IRQ_HANDLED; abortTransfer: RtdAdcClearFifo (dev); /* clears full flag */ @@ -1628,12 +1628,14 @@ transferDone: status = RtdInterruptStatus (dev); RtdInterruptClearMask (dev, status); RtdInterruptClear (dev); - + fifoStatus = RtdFifoStatus (dev); /* DEBUG */ DPRINTK("rtd520: Acquisition complete. %ld ints, intStat=%x, overStat=%x\n", devpriv->intCount, status, 0xffff & RtdInterruptOverrunStatus (dev)); + + return IRQ_HANDLED; } #if 0 diff --git a/comedi/drivers/rti800.c b/comedi/drivers/rti800.c index e38a3f4c..b5ffc064 100644 --- a/comedi/drivers/rti800.c +++ b/comedi/drivers/rti800.c @@ -139,7 +139,7 @@ static comedi_driver driver_rti800={ }; COMEDI_INITCLEANUP(driver_rti800); -static void rti800_interrupt(int irq, void *dev, struct pt_regs *regs); +static irqreturn_t rti800_interrupt(int irq, void *dev, struct pt_regs *regs); typedef struct { enum { @@ -165,10 +165,9 @@ typedef struct { #define RTI800_TIMEOUT 10 -static void rti800_interrupt(int irq, void *dev, struct pt_regs *regs) +static irqreturn_t rti800_interrupt(int irq, void *dev, struct pt_regs *regs) { - - + return IRQ_HANDLED; } // settling delay times in usec for different gains