mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 4/7] staging: comedi: contec_pci_dio: define register map for board
@ 2012-08-16  0:31 H Hartley Sweeten
  0 siblings, 0 replies; only message in thread
From: H Hartley Sweeten @ 2012-08-16  0:31 UTC (permalink / raw)
  To: Linux Kernel; +Cc: devel, abbotti, gregkh

Only one board type is supported by this driver. Instead of
passing the register offsets for the digital in/out ports in
the boardinfo, define the register map and use that to access
the ports.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/comedi/drivers/contec_pci_dio.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/comedi/drivers/contec_pci_dio.c b/drivers/staging/comedi/drivers/contec_pci_dio.c
index 24427ca..698d05b 100644
--- a/drivers/staging/comedi/drivers/contec_pci_dio.c
+++ b/drivers/staging/comedi/drivers/contec_pci_dio.c
@@ -42,26 +42,28 @@ enum contec_model {
 
 struct contec_board {
 	const char *name;
-	int in_offs;
-	int out_offs;
 };
 static const struct contec_board contec_boards[] = {
-	{"PIO1616L", 0, 2 },
+	{"PIO1616L", },
 };
 
 #define PCI_DEVICE_ID_PIO1616L 0x8172
 
+/*
+ * Register map
+ */
+#define PIO1616L_DI_REG		0x00
+#define PIO1616L_DO_REG		0x02
+
 static int contec_do_insn_bits(struct comedi_device *dev,
 			       struct comedi_subdevice *s,
 			       struct comedi_insn *insn, unsigned int *data)
 {
-	const struct contec_board *thisboard = comedi_board(dev);
-
 	if (data[0]) {
 		s->state &= ~data[0];
 		s->state |= data[0] & data[1];
 
-		outw(s->state, dev->iobase + thisboard->out_offs);
+		outw(s->state, dev->iobase + PIO1616L_DO_REG);
 	}
 	return insn->n;
 }
@@ -70,9 +72,7 @@ static int contec_di_insn_bits(struct comedi_device *dev,
 			       struct comedi_subdevice *s,
 			       struct comedi_insn *insn, unsigned int *data)
 {
-	const struct contec_board *thisboard = comedi_board(dev);
-
-	data[1] = inw(dev->iobase + thisboard->in_offs);
+	data[1] = inw(dev->iobase + PIO1616L_DI_REG);
 
 	return insn->n;
 }
-- 
1.7.11


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-08-16  0:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-16  0:31 [PATCH 4/7] staging: comedi: contec_pci_dio: define register map for board H Hartley Sweeten

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome