[PATCH 1/4] staging: comedi: ni_65xx: add ni_65xx_num_ports()

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

 



Add a function to return the total number of digital I/O, digital input,
and digital output ports on the board.  Each port has 8 channels (bits).

Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx>
---
 drivers/staging/comedi/drivers/ni_65xx.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c
index aba6fbb..0f9185e 100644
--- a/drivers/staging/comedi/drivers/ni_65xx.c
+++ b/drivers/staging/comedi/drivers/ni_65xx.c
@@ -296,17 +296,19 @@ struct ni_65xx_private {
 	void __iomem *mmio;
 };
 
-static void ni_65xx_disable_input_filters(struct comedi_device *dev)
+static unsigned int ni_65xx_num_ports(struct comedi_device *dev)
 {
 	const struct ni_65xx_board *board = comedi_board(dev);
+
+	return board->num_dio_ports + board->num_di_ports + board->num_do_ports;
+}
+
+static void ni_65xx_disable_input_filters(struct comedi_device *dev)
+{
 	struct ni_65xx_private *devpriv = dev->private;
-	unsigned num_ports;
+	unsigned int num_ports = ni_65xx_num_ports(dev);
 	int i;
 
-	num_ports = board->num_dio_ports +
-		    board->num_di_ports +
-		    board->num_do_ports;
-
 	/* disable input filtering on all ports */
 	for (i = 0; i < num_ports; ++i)
 		writeb(0x00, devpriv->mmio + NI_65XX_FILTER_ENA(i));
-- 
2.0.0

_______________________________________________
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