[PATCH 29/46] staging: comedi: adl_pci9111: remove pci9111_ai_channel_[gs]et macros

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

 



These macros rely on a local variable having a specific name.

The comedi code makes sure the channel number is valid so the mask
of PCI9111_CHANNEL_MASK can be remove.

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

diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c
index 1eef86d..7131179 100644
--- a/drivers/staging/comedi/drivers/adl_pci9111.c
+++ b/drivers/staging/comedi/drivers/adl_pci9111.c
@@ -95,8 +95,7 @@ TODO:
 #define PCI9111_AO_REG					0x00
 #define PCI9111_DIO_REG					0x02
 #define PCI9111_REGISTER_EXTENDED_IO_PORTS		0x04
-#define PCI9111_REGISTER_AD_CHANNEL_CONTROL		0x06 /* Channel
-								selection */
+#define PCI9111_AI_CHANNEL_REG				0x06
 #define PCI9111_REGISTER_AD_CHANNEL_READBACK		0x06
 #define PCI9111_AI_RANGE_REG				0x08
 #define PCI9111_RANGE_STATUS_REG			0x08
@@ -124,8 +123,6 @@ TODO:
 #define PCI9111_FFEN_SET_FIFO_ENABLE			(0 << 2)
 #define PCI9111_FFEN_SET_FIFO_DISABLE			(1 << 2)
 
-#define PCI9111_CHANNEL_MASK				0x0F
-
 #define PCI9111_RANGE_MASK				0x07
 #define PCI9111_FIFO_EMPTY_MASK				0x10
 #define PCI9111_FIFO_HALF_FULL_MASK			0x20
@@ -176,14 +173,6 @@ TODO:
 	((inb(dev->iobase + PCI9111_RANGE_STATUS_REG)& \
 		PCI9111_FIFO_EMPTY_MASK) == 0)
 
-#define pci9111_ai_channel_set(channel) \
-	outb((channel)&PCI9111_CHANNEL_MASK, \
-		dev->iobase + PCI9111_REGISTER_AD_CHANNEL_CONTROL)
-
-#define pci9111_ai_channel_get() \
-	(inb(dev->iobase + PCI9111_REGISTER_AD_CHANNEL_READBACK) \
-		&PCI9111_CHANNEL_MASK)
-
 static const struct comedi_lrange pci9111_hr_ai_range = {
 	5,
 	{
@@ -594,10 +583,12 @@ static int pci9111_ai_do_cmd(struct comedi_device *dev,
 	/*  TODO: handle the case of an external multiplexer */
 
 	if (async_cmd->chanlist_len > 1) {
-		pci9111_ai_channel_set((async_cmd->chanlist_len) - 1);
+		outb(async_cmd->chanlist_len - 1,
+			dev->iobase + PCI9111_AI_CHANNEL_REG);
 		pci9111_autoscan_set(dev, true);
 	} else {
-		pci9111_ai_channel_set(CR_CHAN(async_cmd->chanlist[0]));
+		outb(CR_CHAN(async_cmd->chanlist[0]),
+			dev->iobase + PCI9111_AI_CHANNEL_REG);
 		pci9111_autoscan_set(dev, false);
 	}
 
@@ -857,7 +848,7 @@ static int pci9111_ai_insn_read(struct comedi_device *dev,
 	int timeout;
 	int i;
 
-	pci9111_ai_channel_set(chan);
+	outb(chan, dev->iobase + PCI9111_AI_CHANNEL_REG);
 
 	current_range = inb(dev->iobase + PCI9111_RANGE_STATUS_REG);
 	if ((current_range & PCI9111_RANGE_MASK) != range) {
-- 
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