From b2b82184c9c9a82553bfd49e7940ebc67fe655a8 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 23 Jan 2013 12:38:44 -0700 Subject: [PATCH] staging: comedi: addi_apci_3501: absorb v_APCI3501_Interrupt() This driver only has one 'interrupt' function. Absorb the v_APCI3501_Interrupt() function from hwdrv_apci3501.c into the driver. Rename v_ADDI_Interrupt() to apci3501_interrupt() so that the function has namespace associated with the driver. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../comedi/drivers/addi-data/hwdrv_apci3501.c | 56 ------------------- .../staging/comedi/drivers/addi_apci_3501.c | 40 +++++++++++-- 2 files changed, 34 insertions(+), 62 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c index 733c7933f79f..74b6eacf5e93 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c @@ -467,59 +467,3 @@ static int i_APCI3501_ReadTimerCounterWatchdog(struct comedi_device *dev, } return insn->n; } - -/* -+----------------------------------------------------------------------------+ -| Function Name : static void v_APCI3501_Interrupt | -| (int irq , void *d) | -+----------------------------------------------------------------------------+ -| Task : Interrupt processing Routine | -+----------------------------------------------------------------------------+ -| Input Parameters : int irq : irq number | -| void *d : void pointer | -+----------------------------------------------------------------------------+ -| Output Parameters : -- | -+----------------------------------------------------------------------------+ -| Return Value : TRUE : No error occur | -| : FALSE : Error occur. Return the error | -| | -+----------------------------------------------------------------------------+ -*/ -static void v_APCI3501_Interrupt(int irq, void *d) -{ - int i_temp; - struct comedi_device *dev = d; - struct addi_private *devpriv = dev->private; - unsigned int ui_Timer_AOWatchdog; - unsigned long ul_Command1; - - /* Disable Interrupt */ - ul_Command1 = - inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); - - ul_Command1 = (ul_Command1 & 0xFFFFF9FDul); - outl(ul_Command1, - devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); - - ui_Timer_AOWatchdog = - inl(devpriv->iobase + APCI3501_WATCHDOG + - APCI3501_TCW_IRQ) & 0x1; - - if ((!ui_Timer_AOWatchdog)) { - comedi_error(dev, "IRQ from unknown source"); - return; - } - -/* -* Enable Interrupt Send a signal to from kernel to user space -*/ - send_sig(SIGIO, devpriv->tsk_Current, 0); - ul_Command1 = - inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); - ul_Command1 = ((ul_Command1 & 0xFFFFF9FDul) | 1 << 1); - outl(ul_Command1, - devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); - i_temp = inl(devpriv->iobase + APCI3501_WATCHDOG + - APCI3501_TCW_TRIG_STATUS) & 0x1; - return; -} diff --git a/drivers/staging/comedi/drivers/addi_apci_3501.c b/drivers/staging/comedi/drivers/addi_apci_3501.c index d6a96bd0f1d7..3c82596790d5 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3501.c +++ b/drivers/staging/comedi/drivers/addi_apci_3501.c @@ -18,7 +18,6 @@ static const struct addi_board apci3501_boardtypes[] = { .pc_EepromChip = ADDIDATA_S5933, .i_AoMaxdata = 16383, .pr_AoRangelist = &range_apci3501_ao, - .interrupt = v_APCI3501_Interrupt, .ao_config = i_APCI3501_ConfigAnalogOutput, .ao_write = i_APCI3501_WriteAnalogOutput, }, @@ -75,13 +74,42 @@ static int i_ADDIDATA_InsnReadEeprom(struct comedi_device *dev, return insn->n; } -static irqreturn_t v_ADDI_Interrupt(int irq, void *d) +static irqreturn_t apci3501_interrupt(int irq, void *d) { struct comedi_device *dev = d; - const struct addi_board *this_board = comedi_board(dev); + struct addi_private *devpriv = dev->private; + unsigned int ui_Timer_AOWatchdog; + unsigned long ul_Command1; + int i_temp; + + /* Disable Interrupt */ + ul_Command1 = + inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); + + ul_Command1 = (ul_Command1 & 0xFFFFF9FDul); + outl(ul_Command1, + devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); + + ui_Timer_AOWatchdog = + inl(devpriv->iobase + APCI3501_WATCHDOG + + APCI3501_TCW_IRQ) & 0x1; + + if ((!ui_Timer_AOWatchdog)) { + comedi_error(dev, "IRQ from unknown source"); + return IRQ_NONE; + } - this_board->interrupt(irq, d); - return IRQ_RETVAL(1); + /* Enable Interrupt Send a signal to from kernel to user space */ + send_sig(SIGIO, devpriv->tsk_Current, 0); + ul_Command1 = + inl(devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); + ul_Command1 = ((ul_Command1 & 0xFFFFF9FDul) | 1 << 1); + outl(ul_Command1, + devpriv->iobase + APCI3501_WATCHDOG + APCI3501_TCW_PROG); + i_temp = inl(devpriv->iobase + APCI3501_WATCHDOG + + APCI3501_TCW_TRIG_STATUS) & 0x1; + + return IRQ_HANDLED; } static int apci3501_reset(struct comedi_device *dev) @@ -190,7 +218,7 @@ static int apci3501_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, apci3501_interrupt, IRQF_SHARED, dev->board_name, dev); if (ret == 0) dev->irq = pcidev->irq; -- 2.30.2