Skip to contentSkip to conversation

macintosh: wrong test in fan_{read,write}_reg()

PATCH In review [email protected] 2 participants 2 messages Jan 18, 2011 Linux for power macintosh

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 macintosh: wrong test in fan_{read,write}_reg()

From: roel kluin <[email protected]>

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

Cc Benjamin Herrenschmidt <[email protected]>

---

 drivers/macintosh/therm_pm72.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/macintosh/therm_pm72.c renamed from drivers/macintosh/therm_pm72.c~macintosh-wrong-test-in-fan_readwrite_reg +2 -2
diff -puN drivers/macintosh/therm_pm72.c~macintosh-wrong-test-in-fan_readwrite_reg drivers/macintosh/therm_pm72.c
@@ -443,7 +443,7 @@ static int fan_read_reg(int reg, unsigne
 	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 
 	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;

_

#1 lore raw
Quoted 3 lines · On Tue, 2011-01-18 at 13:09 -0800, [email protected] wrote:

From: roel kluin <[email protected]>

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

Thanks, I'll pick that up.

Cheers,
Ben.

Quoted 30 lines
Cc Benjamin Herrenschmidt <[email protected]>

---

 drivers/macintosh/therm_pm72.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -puN drivers/macintosh/therm_pm72.c~macintosh-wrong-test-in-fan_readwrite_reg drivers/macintosh/therm_pm72.c

drivers/macintosh/therm_pm72.c renamed from drivers/macintosh/therm_pm72.c~macintosh-wrong-test-in-fan_readwrite_reg +2 -2
@@ -443,7 +443,7 @@ static int fan_read_reg(int reg, unsigne
 	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 
 	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;

_