From de35c94178d6315f6def773a2137bc82a840f3d8 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 23 Jul 2014 10:41:18 +0100 Subject: [PATCH] staging: comedi: ni_65xx: add ni_65xx_num_ports() 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 Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_65xx.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index aba6fbbe340a..0f9185ebda66 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -296,16 +296,18 @@ 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); - struct ni_65xx_private *devpriv = dev->private; - unsigned num_ports; - int i; - num_ports = board->num_dio_ports + - board->num_di_ports + - board->num_do_ports; + 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 int num_ports = ni_65xx_num_ports(dev); + int i; /* disable input filtering on all ports */ for (i = 0; i < num_ports; ++i)