[PATCH 12/22] staging: comedi: ni_6527: rename CamelCase defines for the control register

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

 



Rename the CamelCase defines used for the interrupt control register.

To clarify the code a bit, add two new defines to enable/disable the
interrupts.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/ni_6527.c | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_6527.c b/drivers/staging/comedi/drivers/ni_6527.c
index 5be2bf5..5ca6d89 100644
--- a/drivers/staging/comedi/drivers/ni_6527.c
+++ b/drivers/staging/comedi/drivers/ni_6527.c
@@ -58,13 +58,16 @@ Updated: Sat, 25 Jan 2003 13:24:40 -0800
 #define NI6527_STATUS_IRQ		(1 << 2)
 #define NI6527_STATUS_OVERFLOW		(1 << 1)
 #define NI6527_STATUS_EDGE		(1 << 0)
-
-#define Master_Interrupt_Control		0x15
-#define FallingEdgeIntEnable		0x10
-#define RisingEdgeIntEnable		0x08
-#define MasterInterruptEnable		0x04
-#define OverflowIntEnable		0x02
-#define EdgeIntEnable			0x01
+#define NI6527_CTRL_REG			0x15
+#define NI6527_CTRL_FALLING		(1 << 4)
+#define NI6527_CTRL_RISING		(1 << 3)
+#define NI6527_CTRL_IRQ			(1 << 2)
+#define NI6527_CTRL_OVERFLOW		(1 << 1)
+#define NI6527_CTRL_EDGE		(1 << 0)
+#define NI6527_CTRL_DISABLE_IRQS	0
+#define NI6527_CTRL_ENABLE_IRQS		(NI6527_CTRL_FALLING | \
+					 NI6527_CTRL_RISING | \
+					 NI6527_CTRL_IRQ | NI6527_CTRL_EDGE)
 
 #define Rising_Edge_Detection_Enable(x)		(0x018+(x))
 #define Falling_Edge_Detection_Enable(x)	(0x020+(x))
@@ -273,9 +276,8 @@ static int ni6527_intr_cmd(struct comedi_device *dev,
 
 	writeb(NI6527_CLR_IRQS,
 	       devpriv->mite->daq_io_addr + NI6527_CLR_REG);
-	writeb(FallingEdgeIntEnable | RisingEdgeIntEnable |
-	       MasterInterruptEnable | EdgeIntEnable,
-	       devpriv->mite->daq_io_addr + Master_Interrupt_Control);
+	writeb(NI6527_CTRL_ENABLE_IRQS,
+	       devpriv->mite->daq_io_addr + NI6527_CTRL_REG);
 
 	return 0;
 }
@@ -285,7 +287,8 @@ static int ni6527_intr_cancel(struct comedi_device *dev,
 {
 	struct ni6527_private *devpriv = dev->private;
 
-	writeb(0x00, devpriv->mite->daq_io_addr + Master_Interrupt_Control);
+	writeb(NI6527_CTRL_DISABLE_IRQS,
+	       devpriv->mite->daq_io_addr + NI6527_CTRL_REG);
 
 	return 0;
 }
@@ -402,7 +405,8 @@ static int ni6527_auto_attach(struct comedi_device *dev,
 
 	writeb(NI6527_CLR_IRQS | NI6527_CLR_RESET_FILT,
 	       devpriv->mite->daq_io_addr + NI6527_CLR_REG);
-	writeb(0x00, devpriv->mite->daq_io_addr + Master_Interrupt_Control);
+	writeb(NI6527_CTRL_DISABLE_IRQS,
+	       devpriv->mite->daq_io_addr + NI6527_CTRL_REG);
 
 	ret = request_irq(mite_irq(devpriv->mite), ni6527_interrupt,
 			  IRQF_SHARED, dev->board_name, dev);
@@ -419,8 +423,8 @@ static void ni6527_detach(struct comedi_device *dev)
 	struct ni6527_private *devpriv = dev->private;
 
 	if (devpriv && devpriv->mite && devpriv->mite->daq_io_addr)
-		writeb(0x00,
-		       devpriv->mite->daq_io_addr + Master_Interrupt_Control);
+		writeb(NI6527_CTRL_DISABLE_IRQS,
+		       devpriv->mite->daq_io_addr + NI6527_CTRL_REG);
 	if (dev->irq)
 		free_irq(dev->irq, dev);
 	if (devpriv && devpriv->mite) {
-- 
1.8.3.2

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-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