V4L/DVB (9778): cx18: cx18_writel_expect() should not declare success on a PCI read...
authorAndy Walls <awalls@radix.net>
Sun, 30 Nov 2008 13:01:21 +0000 (10:01 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 30 Dec 2008 11:38:20 +0000 (09:38 -0200)
cx18: cx18_writel_expect() should not declare success on a PCI read error.
This removes the potential for cx18_write*_expect() calls to not
accomplish a PCI write successfully as expected.  The CX18-AV core uses the
*expect() calls often and this may be the source of intermittent audio
problems and standands switching problems.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx18/cx18-io.h

index e6716dcb1e8b9331d79025bf2cd606c56be27bc2..2635b3a8cc96cafea7db8068ae1ab77066f16e01 100644 (file)
@@ -83,10 +83,14 @@ void cx18_writel_expect(struct cx18 *cx, u32 val, void __iomem *addr,
                        u32 eval, u32 mask)
 {
        int i;
+       u32 r;
        eval &= mask;
        for (i = 0; i < CX18_MAX_MMIO_WR_RETRIES; i++) {
                cx18_writel_noretry(cx, val, addr);
-               if (eval == (cx18_readl(cx, addr) & mask))
+               r = cx18_readl(cx, addr);
+               if (r == 0xffffffff && eval != 0xffffffff)
+                       continue;
+               if (eval == (r & mask))
                        break;
        }
 }