From e0da48cb4559df480136b671a6e84ac36ca6a8ad Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 20 Mar 2012 14:40:57 +0000 Subject: [PATCH] pcl818: Fix write instruction for AO subdevice Max Korovkin reported that analog output was not working on Advantech PCI818L and found the cause to be an operator precedence error in pcl818_ao_insn_write(). The effect of the bug was that the function wrote to absolute I/O port addresses 6 and 7 (part of the ISA DMA controller) instead of the port addresses assigned to the board. The same bug was reported by Kudlaty on 2010-11-25, but was not investigated further at the time. The same bug was already fixed by Roel Kluin in the "staging" version of this driver in the 2.6.31 kernel back in May 2009 (commit f764df88f86c8db669bd7bfac230b9d2689ae322 in Linus's linux-2.6 git repository). Signed-off-by: Ian Abbott --- comedi/drivers/pcl818.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comedi/drivers/pcl818.c b/comedi/drivers/pcl818.c index fe0166cc..ef8e1029 100644 --- a/comedi/drivers/pcl818.c +++ b/comedi/drivers/pcl818.c @@ -456,9 +456,9 @@ static int pcl818_ao_insn_write(comedi_device * dev, comedi_subdevice * s, for (n = 0; n < insn->n; n++) { devpriv->ao_readback[chan] = data[n]; outb((data[n] & 0x000f) << 4, dev->iobase + - (chan) ? PCL718_DA2_LO : PCL818_DA_LO); + (chan ? PCL718_DA2_LO : PCL818_DA_LO)); outb((data[n] & 0x0ff0) >> 4, dev->iobase + - (chan) ? PCL718_DA2_HI : PCL818_DA_HI); + (chan ? PCL718_DA2_HI : PCL818_DA_HI)); } return n; -- 2.26.2