staging: comedi: amplc_dio200: support memory-mapped I/O
authorIan Abbott <abbotti@mev.co.uk>
Wed, 24 Oct 2012 15:48:01 +0000 (16:48 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Oct 2012 22:25:17 +0000 (15:25 -0700)
commit71b3e9e8dc218133417d3c167632a61f9fed3651
treed5f9d14c72713d25fccee0b13f973af23394498c
parent9bfa0d548c0ca427cba4a1c26658f870cfda64ca
staging: comedi: amplc_dio200: support memory-mapped I/O

The boards currently supported by this module all use port I/O.  Support
memory-mapped I/O as well for future PCI/PCIe cards.

Define `struct dio200_region` to hold the type of register access and
either the port I/O base address or an ioremapped MMIO address.  Add a
member `io` to the comedi device private data (`struct dio200_private`)
to hold this.  Use this instead of `dev->iobase`.  Memory-mapped
registers are mapped in `dio200_pci_attach()` and unmapped in
`dio200_detach()`.

`dio200_detach()` now uses the private data pointer `devpriv` set to
`dev->private` but can return early if it is `NULL` because no clean-up
needs to be done in that case.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/amplc_dio200.c