Move the defines for the APCI1564_DI_IRQ_REG from the included source file to the main driver source file. For aesthetics, rename the bit defines so they have namespace associated with the register define. Also, remove the unnecessary 'disable' define and convert the 'enable' define to a bit-shift. Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx> Cc: Ian Abbott <abbotti@xxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- .../comedi/drivers/addi-data/hwdrv_apci1564.c | 8 -------- drivers/staging/comedi/drivers/addi_apci_1564.c | 23 ++++++++++++---------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c index 8eebece..2ec9cf3 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -1,11 +1,3 @@ -/* Digital Input IRQ Function Selection */ -#define APCI1564_DI_INT_OR (0 << 1) -#define APCI1564_DI_INT_AND (1 << 1) - -/* Digital Input Interrupt Enable Disable. */ -#define APCI1564_DI_INT_ENABLE 0x4 -#define APCI1564_DI_INT_DISABLE 0xfffffffb - /* Digital Output Interrupt Enable Disable. */ #define APCI1564_DO_VCC_INT_ENABLE 0x1 #define APCI1564_DO_VCC_INT_DISABLE 0xfffffffe diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c index b8bcfb9..5eb4940 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1564.c +++ b/drivers/staging/comedi/drivers/addi_apci_1564.c @@ -45,6 +45,9 @@ #define APCI1564_DI_INT_MODE2_REG 0x0c #define APCI1564_DI_INT_STATUS_REG 0x10 #define APCI1564_DI_IRQ_REG 0x14 +#define APCI1564_DI_IRQ_ENA (1 << 2) +#define APCI1564_DI_IRQ_OR (0 << 1) +#define APCI1564_DI_IRQ_AND (1 << 1) #define APCI1564_DO_REG 0x18 #define APCI1564_DO_INT_CTRL_REG 0x1c #define APCI1564_DO_INT_STATUS_REG 0x20 @@ -135,9 +138,9 @@ static irqreturn_t apci1564_interrupt(int irq, void *d) return IRQ_NONE; status = inl(dev->iobase + APCI1564_DI_IRQ_REG); - if (status & APCI1564_DI_INT_ENABLE) { + if (status & APCI1564_DI_IRQ_ENA) { /* disable the interrupt */ - outl(status & APCI1564_DI_INT_DISABLE, + outl(status & ~APCI1564_DI_IRQ_ENA, dev->iobase + APCI1564_DI_IRQ_REG); s->state = inl(dev->iobase + APCI1564_DI_INT_STATUS_REG) @@ -275,11 +278,11 @@ static int apci1564_cos_insn_config(struct comedi_device *dev, outl(0x0, dev->iobase + APCI1564_DI_INT_MODE2_REG); break; case COMEDI_DIGITAL_TRIG_ENABLE_EDGES: - if (devpriv->ctrl != (APCI1564_DI_INT_ENABLE | - APCI1564_DI_INT_OR)) { + if (devpriv->ctrl != (APCI1564_DI_IRQ_ENA | + APCI1564_DI_IRQ_OR)) { /* switching to 'OR' mode */ - devpriv->ctrl = APCI1564_DI_INT_ENABLE | - APCI1564_DI_INT_OR; + devpriv->ctrl = APCI1564_DI_IRQ_ENA | + APCI1564_DI_IRQ_OR; /* wipe old channels */ devpriv->mode1 = 0; devpriv->mode2 = 0; @@ -293,11 +296,11 @@ static int apci1564_cos_insn_config(struct comedi_device *dev, devpriv->mode2 |= data[5] << shift; break; case COMEDI_DIGITAL_TRIG_ENABLE_LEVELS: - if (devpriv->ctrl != (APCI1564_DI_INT_ENABLE | - APCI1564_DI_INT_AND)) { + if (devpriv->ctrl != (APCI1564_DI_IRQ_ENA | + APCI1564_DI_IRQ_AND)) { /* switching to 'AND' mode */ - devpriv->ctrl = APCI1564_DI_INT_ENABLE | - APCI1564_DI_INT_AND; + devpriv->ctrl = APCI1564_DI_IRQ_ENA | + APCI1564_DI_IRQ_AND; /* wipe old channels */ devpriv->mode1 = 0; devpriv->mode2 = 0; -- 2.0.3 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel