From: Ian Abbott <abbotti@mev.co.uk>
To: driverdev-devel@linuxdriverproject.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Ian Abbott <abbotti@mev.co.uk>,
H Hartley Sweeten <hartleys@visionengravers.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/4] staging: comedi: ni_65xx: add ni_65xx_num_ports()
Date: Wed, 23 Jul 2014 10:41:18 +0100 [thread overview]
Message-ID: <1406108481-23910-2-git-send-email-abbotti@mev.co.uk> (raw)
In-Reply-To: <1406108481-23910-1-git-send-email-abbotti@mev.co.uk>
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@mev.co.uk>
---
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
next prev parent reply other threads:[~2014-07-23 9:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-23 9:41 [PATCH 0/4] staging: comedi: ni_65xx: edge detection changes Ian Abbott
2014-07-23 9:41 ` Ian Abbott [this message]
2014-07-23 9:41 ` [PATCH 2/4] staging: comedi: ni_65xx: refactor edge detection configuration Ian Abbott
2014-07-23 9:41 ` [PATCH 3/4] staging: comedi: ni_65xx: support INSN_CONFIG_DIGITAL_TRIG Ian Abbott
2014-07-23 9:41 ` [PATCH 4/4] staging: comedi: ni_65xx: disable edge detection on initialization Ian Abbott
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1406108481-23910-2-git-send-email-abbotti@mev.co.uk \
--to=abbotti@mev.co.uk \
--cc=driverdev-devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=hartleys@visionengravers.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®