Commit 34ed78e8 authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: amplc_dio200: add register shift to board info

Add `mainshift` member to `struct dio200_board` to hold the amount of
left-shift required for main register offsets.  This is 0 for all the
boards currently supported so it doesn't need initializing explicitly in
any current element of `dio200_boards[]`.  It will be non-zero for some
new boards to be supported by this driver.

Modify the register access functions `dio200_read8()` and
`dio200_write8()` to take the shift into account.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 805afd6b
...@@ -309,6 +309,7 @@ struct dio200_board { ...@@ -309,6 +309,7 @@ struct dio200_board {
enum dio200_model model; enum dio200_model model;
enum dio200_layout_idx layout; enum dio200_layout_idx layout;
unsigned char mainbar; unsigned char mainbar;
unsigned char mainshift;
unsigned int mainsize; unsigned int mainsize;
}; };
...@@ -504,8 +505,10 @@ static inline bool is_isa_board(const struct dio200_board *board) ...@@ -504,8 +505,10 @@ static inline bool is_isa_board(const struct dio200_board *board)
static unsigned char dio200_read8(struct comedi_device *dev, static unsigned char dio200_read8(struct comedi_device *dev,
unsigned int offset) unsigned int offset)
{ {
const struct dio200_board *thisboard = comedi_board(dev);
struct dio200_private *devpriv = dev->private; struct dio200_private *devpriv = dev->private;
offset <<= thisboard->mainshift;
if (devpriv->io.regtype == io_regtype) if (devpriv->io.regtype == io_regtype)
return inb(devpriv->io.u.iobase + offset); return inb(devpriv->io.u.iobase + offset);
else else
...@@ -518,8 +521,10 @@ static unsigned char dio200_read8(struct comedi_device *dev, ...@@ -518,8 +521,10 @@ static unsigned char dio200_read8(struct comedi_device *dev,
static void dio200_write8(struct comedi_device *dev, unsigned int offset, static void dio200_write8(struct comedi_device *dev, unsigned int offset,
unsigned char val) unsigned char val)
{ {
const struct dio200_board *thisboard = comedi_board(dev);
struct dio200_private *devpriv = dev->private; struct dio200_private *devpriv = dev->private;
offset <<= thisboard->mainshift;
if (devpriv->io.regtype == io_regtype) if (devpriv->io.regtype == io_regtype)
outb(val, devpriv->io.u.iobase + offset); outb(val, devpriv->io.u.iobase + offset);
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment