Skip to contentSkip to conversation

OLPC: Don't retry EC commands forever

PATCH In review Daniel Drake 2 participants 3 messages Oct 1, 2010 – Oct 5, 2010 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OLPC: Don't retry EC commands forever

From: Paul Fox <[email protected]>

Avoids a potential infinite loop

---
 arch/x86/kernel/olpc.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/x86/kernel/olpc.c +4 -1
index 37c49934..7472613 100644
@@ -114,6 +114,7 @@ int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen,
 	unsigned long flags;
 	int ret = -EIO;
 	int i;
+	int restarts = 0;
 
 	spin_lock_irqsave(&ec_lock, flags);
 
@@ -169,7 +170,9 @@ restart:
 			if (wait_on_obf(0x6c, 1)) {
 				printk(KERN_ERR "olpc-ec:  timeout waiting for"
 						" EC to provide data!\n");
-				goto restart;
+				if (restarts++ < 10)
+					goto restart;
+				goto err;
 			}
 			outbuf[i] = inb(0x68);
 			pr_devel("olpc-ec:  received 0x%x\n", outbuf[i]);
Signature · 1 line
1.7.2.3
#1 lore raw
Quoted 3 lines · Daniel Drake

From: Paul Fox <[email protected]>

Avoids a potential infinite loop

Was this infinite loop observed in practice? I.e. should this get into .36 and into -stable?

Ingo

#2 lore raw
Quoted 9 lines · Ingo Molnar
Quoted 3 lines · Daniel Drake

From: Paul Fox <[email protected]>

Avoids a potential infinite loop

Was this infinite loop observed in practice? I.e. should this get into .36 and into -stable?

It was observed once, but only during an EC hacking/debugging session
- not in regular operation.
So it should be fine for the next merge window with no need to backport it.

Thanks,
Daniel