staging: comedi: amplc_pc263: Correct initial state
authorIan Abbott <abbotti@mev.co.uk>
Wed, 30 May 2012 18:04:35 +0000 (19:04 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 Jun 2012 03:48:06 +0000 (20:48 -0700)
The initial state of the relays is being read incorrectly.  It's reading
a single 8-bit port twice, but should be reading two consecutive 8-bit
ports.  Fix it.

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

index 086579f756ff07f70ca83c70acede54d06f29c37..e2dbf74be81a7b0e5898d1e3d478af52f9ac8b56 100644 (file)
@@ -330,8 +330,7 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        /* all outputs */
        s->io_bits = 0xffff;
        /* read initial relay state */
-       s->state = inb(dev->iobase);
-       s->state = s->state | (inb(dev->iobase) << 8);
+       s->state = inb(dev->iobase) | (inb(dev->iobase + 1) << 8);
 
        printk(KERN_INFO "comedi%d: %s ", dev->minor, dev->board_name);
        switch (thisboard->bustype) {