From: H Hartley Sweeten Date: Wed, 12 Aug 2015 20:25:48 +0000 (-0700) Subject: staging: comedi: hwdrv_apci3501: remove "magic" numbers in apci3501_config_insn_timer() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7dc68e350460c4c1620f79f23be70739845994ff;p=linux-beck.git staging: comedi: hwdrv_apci3501: remove "magic" numbers in apci3501_config_insn_timer() Use register bit defines from addi_tcw.h to remove the "magic" numbers. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c index 8ba094cc31f4..c4a72a5b343f 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.c @@ -37,12 +37,13 @@ static int apci3501_config_insn_timer(struct comedi_device *dev, ctrl = 0; } else { ctrl = inl(devpriv->tcw + ADDI_TCW_CTRL_REG); - ctrl &= 0xfffff9fe; + ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG | + ADDI_TCW_CTRL_ENA); } outl(ctrl, devpriv->tcw + ADDI_TCW_CTRL_REG); /* enable/disable the timer interrupt */ - ctrl = (data[1] == 1) ? 0x2 : 0; + ctrl = (data[1] == 1) ? ADDI_TCW_CTRL_IRQ_ENA : 0; outl(ctrl, devpriv->tcw + ADDI_TCW_CTRL_REG); outl(data[2], devpriv->tcw + ADDI_TCW_TIMEBASE_REG); @@ -51,11 +52,18 @@ static int apci3501_config_insn_timer(struct comedi_device *dev, ctrl = inl(devpriv->tcw + ADDI_TCW_CTRL_REG); if (devpriv->timer_mode == ADDIDATA_WATCHDOG) { /* Set the mode (e2->e0) NOTE: this doesn't look correct */ - ctrl |= 0xfff819e0; + ctrl |= ~(ADDI_TCW_CTRL_CNT_UP | ADDI_TCW_CTRL_EXT_CLK_MASK | + ADDI_TCW_CTRL_MODE_MASK | ADDI_TCW_CTRL_GATE | + ADDI_TCW_CTRL_TRIG | ADDI_TCW_CTRL_TIMER_ENA | + ADDI_TCW_CTRL_RESET_ENA | ADDI_TCW_CTRL_WARN_ENA | + ADDI_TCW_CTRL_IRQ_ENA | ADDI_TCW_CTRL_ENA); } else { /* mode 2 */ - ctrl &= 0xfff719e2; - ctrl |= (2 << 13) | 0x10; + ctrl &= ~(ADDI_TCW_CTRL_CNTR_ENA | ADDI_TCW_CTRL_MODE_MASK | + ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG | + ADDI_TCW_CTRL_TIMER_ENA | ADDI_TCW_CTRL_RESET_ENA | + ADDI_TCW_CTRL_WARN_ENA | ADDI_TCW_CTRL_ENA); + ctrl |= ADDI_TCW_CTRL_MODE(2) | ADDI_TCW_CTRL_TIMER_ENA; } outl(ctrl, devpriv->tcw + ADDI_TCW_CTRL_REG);