public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] macintosh: wrong test in fan_{read,write}_reg()
@ 2010-12-31 14:57 roel kluin
  0 siblings, 0 replies; only message in thread
From: roel kluin @ 2010-12-31 14:57 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, linuxppc-dev, Andrew Morton, LKML

Fix error test in fan_{read,write}_reg()

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
 drivers/macintosh/therm_pm72.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

ENODEV and EIO are positive (22 and 8), so the tests did not work.

diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c
index 4454927..6256a08 100644
--- a/drivers/macintosh/therm_pm72.c
+++ b/drivers/macintosh/therm_pm72.c
@@ -443,7 +443,7 @@ static int fan_read_reg(int reg, unsigned char *buf, int nb)
 	tries = 0;
 	for (;;) {
 		nr = i2c_master_recv(fcu, buf, nb);
-		if (nr > 0 || (nr < 0 && nr != ENODEV) || tries >= 100)
+		if (nr > 0 || (nr < 0 && nr != -ENODEV) || tries >= 100)
 			break;
 		msleep(10);
 		++tries;
@@ -464,7 +464,7 @@ static int fan_write_reg(int reg, const unsigned char *ptr, int nb)
 	tries = 0;
 	for (;;) {
 		nw = i2c_master_send(fcu, buf, nb);
-		if (nw > 0 || (nw < 0 && nw != EIO) || tries >= 100)
+		if (nw > 0 || (nw < 0 && nw != -EIO) || tries >= 100)
 			break;
 		msleep(10);
 		++tries;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-12-31 14:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-31 14:57 [PATCH] macintosh: wrong test in fan_{read,write}_reg() roel kluin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox