i2c-pca: Fix waitforcompletion() return value
commit606ac4acd0f171a58647f74106dd959c451d258e
authorYegor Yefremov <yegor_sub1@visionsystems.de>
Thu, 30 Sep 2010 12:14:22 +0000 (30 14:14 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 29 Oct 2010 04:44:01 +0000 (28 21:44 -0700)
treef5e98f72932b1c2db8c47e8019b63e9afbda1a13
parent0bd9ac380a44611e953b1657d7f54075b2f77fb0
i2c-pca: Fix waitforcompletion() return value

commit 6abb930af064fb1cf4177d32e2c7bfb89eee0fe5 upstream.

ret is still -1, if during the polling read_byte() returns at once
with I2C_PCA_CON_SI set. So ret > 0 would lead *_waitforcompletion()
to return 0, in spite of the proper behavior.

The routine was rewritten, so that ret has always a proper value,
before returning.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/i2c/busses/i2c-pca-isa.c
drivers/i2c/busses/i2c-pca-platform.c