i2c-bfin-twi: return completion in interrupt for smbus quick transfers
authorSonic Zhang <sonic.zhang@analog.com>
Mon, 22 Mar 2010 07:23:20 +0000 (03:23 -0400)
committerBen Dooks <ben-linux@fluff.org>
Wed, 19 May 2010 23:18:58 +0000 (00:18 +0100)
A smbus quick transfer has no data after the address byte.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
drivers/i2c/busses/i2c-bfin-twi.c

index dabfa80cf5f2236a6d815e48c8b8b16827379153..fb26e5c67515b6e314823fd50001e989e62886a0 100644 (file)
@@ -159,18 +159,14 @@ static void bfin_twi_handle_interrupt(struct bfin_twi_iface *iface,
                if (mast_stat & BUFWRERR)
                        dev_dbg(&iface->adap.dev, "Buffer Write Error\n");
 
-               /* if both err and complete int stats are set, return proper
-                * results.
+               /* If it is a quick transfer, only address without data,
+                * not an err, return 1.
                 */
-               if (twi_int_status & MCOMP) {
-                       /* If it is a quick transfer, only address without data,
-                        * not an err, return 1.
-                        * If address is acknowledged return 1.
-                        */
-                       if ((iface->writeNum == 0 && (mast_stat & BUFRDERR))
-                               || !(mast_stat & ANAK))
-                               iface->result = 1;
-               }
+               if (iface->cur_mode == TWI_I2C_MODE_STANDARD &&
+                       iface->transPtr == NULL &&
+                       (twi_int_status & MCOMP) && (mast_stat & DNAK))
+                       iface->result = 1;
+
                complete(&iface->complete);
                return;
        }