[PATCH 04/41] staging: comedi: addi_apci_1516: define the watchdog control register

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add defines for the bits in the watchdog control register and use
them to remove the "magic" numbers.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c
index f1b209d..a0d29be 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1516.c
@@ -64,6 +64,8 @@ You should also find the complete GPL in the COPYING file accompanying this sour
 #define APCI1516_WDOG_RELOAD_LSB_REG		0x04
 #define APCI1516_WDOG_RELOAD_MSB_REG		0x06
 #define APCI1516_WDOG_CTRL_REG			0x0c
+#define APCI1516_WDOG_CTRL_ENABLE		(1 << 0)
+#define APCI1516_WDOG_CTRL_SOFT_TRIG		(1 << 9)
 #define APCI1516_WDOG_STATUS_REG		0x10
 
 #define ADDIDATA_WATCHDOG			2
@@ -182,10 +184,12 @@ static int i_APCI1516_StartStopWriteWatchdog(struct comedi_device *dev,
 		outw(0x0, devpriv->i_IobaseAddon + APCI1516_WDOG_CTRL_REG);
 		break;
 	case 1:		/* start the watchdog */
-		outw(0x0001, devpriv->i_IobaseAddon + APCI1516_WDOG_CTRL_REG);
+		outw(APCI1516_WDOG_CTRL_ENABLE,
+		     devpriv->i_IobaseAddon + APCI1516_WDOG_CTRL_REG);
 		break;
 	case 2:		/* Software trigger */
-		outw(0x0201, devpriv->i_IobaseAddon + APCI1516_WDOG_CTRL_REG);
+		outw(APCI1516_WDOG_CTRL_ENABLE | APCI1516_WDOG_CTRL_SOFT_TRIG,
+		     devpriv->i_IobaseAddon + APCI1516_WDOG_CTRL_REG);
 		break;
 	default:
 		printk("\nSpecified functionality does not exist\n");
-- 
1.7.11

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux