From 6c76d4e778a05c86f463a5bee3e2b06a9cc4396a Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 14 Oct 2014 10:44:20 -0700 Subject: [PATCH] staging: comedi: addi_common.c: remove v_ADDI_Interrupt() The addi_apci_035 and addi_apci_1500 are the only drivers left that use this function in addi_common.c. The function simply calls the 'interrupt' function that is in the boardinfo of the driver. Both drivers use the same 'interrupt' function for all boardnfo entries. Remove the i_ADDI_Reset() function as well as the 'interrupt' boardinfo and use the 'interrupt' function directly when doing the request_irq(). In addition, the addi_apci_3120 driver has a private v_ADDI_Interrupt() function that is doing the same thing. Remove that one as well. Fix the return type of 'interrupt' functions in the drivers and add the return vaules. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../staging/comedi/drivers/addi-data/addi_common.c | 9 --------- .../comedi/drivers/addi-data/hwdrv_apci035.c | 4 +++- .../comedi/drivers/addi-data/hwdrv_apci1500.c | 4 +++- .../comedi/drivers/addi-data/hwdrv_apci3120.c | 6 ++++-- drivers/staging/comedi/drivers/addi_apci_035.c | 3 +-- drivers/staging/comedi/drivers/addi_apci_1500.c | 3 +-- drivers/staging/comedi/drivers/addi_apci_3120.c | 13 +------------ 7 files changed, 13 insertions(+), 29 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c index 850bdae48243..014342748765 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c @@ -55,12 +55,3 @@ static int i_ADDIDATA_InsnReadEeprom(struct comedi_device *dev, return insn->n; } - -static irqreturn_t v_ADDI_Interrupt(int irq, void *d) -{ - struct comedi_device *dev = d; - const struct addi_board *this_board = dev->board_ptr; - - this_board->interrupt(irq, d); - return IRQ_RETVAL(1); -} diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c index 53bb51bd77b5..a07ee1bd3311 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c @@ -434,7 +434,7 @@ static int apci035_reset(struct comedi_device *dev) return 0; } -static void apci035_interrupt(int irq, void *d) +static irqreturn_t apci035_interrupt(int irq, void *d) { struct comedi_device *dev = d; struct addi_private *devpriv = dev->private; @@ -477,4 +477,6 @@ static void apci035_interrupt(int irq, void *d) /* send signal to the sample */ send_sig(SIGIO, devpriv->tsk_Current, 0); } + + return IRQ_HANDLED; } diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c index 0ea081e1e119..9896468d86f9 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c @@ -2011,7 +2011,7 @@ static int apci1500_do_bits(struct comedi_device *dev, return insn->n; } -static void apci1500_interrupt(int irq, void *d) +static irqreturn_t apci1500_interrupt(int irq, void *d) { struct comedi_device *dev = d; @@ -2180,6 +2180,8 @@ static void apci1500_interrupt(int irq, void *d) "Interrupt from unknown source\n"); } + + return IRQ_HANDLED; } static int apci1500_reset(struct comedi_device *dev) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index b06142b27df7..ed1d92ecc9ea 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -1415,7 +1415,7 @@ static int apci3120_interrupt_handle_eos(struct comedi_device *dev) return 0; } -static void apci3120_interrupt(int irq, void *d) +static irqreturn_t apci3120_interrupt(int irq, void *d) { struct comedi_device *dev = d; struct addi_private *devpriv = dev->private; @@ -1432,7 +1432,7 @@ static void apci3120_interrupt(int irq, void *d) if ((!int_daq) && (!(int_amcc & ANY_S593X_INT))) { dev_err(dev->class_dev, "IRQ from unknown source\n"); - return; + return IRQ_NONE; } outl(int_amcc | 0x00ff0000, devpriv->i_IobaseAmcc + AMCC_OP_REG_INTCSR); /* shutdown IRQ reasons in AMCC */ @@ -1587,6 +1587,8 @@ static void apci3120_interrupt(int irq, void *d) } comedi_handle_events(dev, s); + + return IRQ_HANDLED; } /* diff --git a/drivers/staging/comedi/drivers/addi_apci_035.c b/drivers/staging/comedi/drivers/addi_apci_035.c index 4f068c2e6a70..a712cc522006 100644 --- a/drivers/staging/comedi/drivers/addi_apci_035.c +++ b/drivers/staging/comedi/drivers/addi_apci_035.c @@ -27,7 +27,6 @@ static const struct addi_board apci035_boardtypes[] = { .i_Timer = 1, .ui_MinAcquisitiontimeNs = 10000, .ui_MinDelaytimeNs = 100000, - .interrupt = apci035_interrupt, .ai_config = apci035_ai_config, .ai_read = apci035_ai_read, .timer_config = apci035_timer_config, @@ -84,7 +83,7 @@ static int apci035_auto_attach(struct comedi_device *dev, /* ## */ if (pcidev->irq > 0) { - ret = request_irq(pcidev->irq, v_ADDI_Interrupt, IRQF_SHARED, + ret = request_irq(pcidev->irq, apci035_interrupt, IRQF_SHARED, dev->board_name, dev); if (ret == 0) dev->irq = pcidev->irq; diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c b/drivers/staging/comedi/drivers/addi_apci_1500.c index a4a0dab85d6a..857ac9876467 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1500.c +++ b/drivers/staging/comedi/drivers/addi_apci_1500.c @@ -20,7 +20,6 @@ static const struct addi_board apci1500_boardtypes[] = { .i_NbrDoChannel = 16, .i_DoMaxdata = 0xffff, .i_Timer = 1, - .interrupt = apci1500_interrupt, .di_config = apci1500_di_config, .di_read = apci1500_di_read, .di_write = apci1500_di_write, @@ -83,7 +82,7 @@ static int apci1500_auto_attach(struct comedi_device *dev, /* ## */ if (pcidev->irq > 0) { - ret = request_irq(pcidev->irq, v_ADDI_Interrupt, IRQF_SHARED, + ret = request_irq(pcidev->irq, apci1500_interrupt, IRQF_SHARED, dev->board_name, dev); if (ret == 0) dev->irq = pcidev->irq; diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index ba71e24a56fd..38da44bd4eef 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -26,7 +26,6 @@ static const struct addi_board apci3120_boardtypes[] = { .i_NbrDiChannel = 4, .i_NbrDoChannel = 4, .i_DoMaxdata = 0x0f, - .interrupt = apci3120_interrupt, }, [BOARD_APCI3001] = { .pc_DriverName = "apci3001", @@ -37,19 +36,9 @@ static const struct addi_board apci3120_boardtypes[] = { .i_NbrDiChannel = 4, .i_NbrDoChannel = 4, .i_DoMaxdata = 0x0f, - .interrupt = apci3120_interrupt, }, }; -static irqreturn_t v_ADDI_Interrupt(int irq, void *d) -{ - struct comedi_device *dev = d; - const struct addi_board *this_board = dev->board_ptr; - - this_board->interrupt(irq, d); - return IRQ_RETVAL(1); -} - static int apci3120_auto_attach(struct comedi_device *dev, unsigned long context) { @@ -82,7 +71,7 @@ static int apci3120_auto_attach(struct comedi_device *dev, devpriv->i_IobaseReserved = pci_resource_start(pcidev, 3); if (pcidev->irq > 0) { - ret = request_irq(pcidev->irq, v_ADDI_Interrupt, IRQF_SHARED, + ret = request_irq(pcidev->irq, apci3120_interrupt, IRQF_SHARED, dev->board_name, dev); if (ret == 0) dev->irq = pcidev->irq; -- 2.30.2