Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[PATCH] SCX200_ACB: eliminate spurious timeout errors

While busy-waiting for completion, check the hardware after scheduling;
don't schedule and then immediately check the _timeout_. If the yield()
took a long time (as it does on my OLPC prototype board when it's busy),
we'd report a timeout even though the hardware was now ready.

This fixes it, and also switches the yield() for a cond_resched() because
we don't actually want to be _that_ nice about it. I see nice
tightly-packed SMBus transactions now, rather than waiting for milliseconds
between successive phases.

Actually, we shouldn't be busy-waiting here at all. We should be using
interrupts. That's an exercise for another day though.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Cc: Christer Weinigel <wingel@nano-system.com>
Cc: <Jordan.Crouse@amd.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

David Woodhouse and committed by
Linus Torvalds
3e3183ba 225add61

+5 -2
+5 -2
drivers/i2c/busses/scx200_acb.c
··· 232 232 unsigned long timeout; 233 233 234 234 timeout = jiffies + POLL_TIMEOUT; 235 - while (time_before(jiffies, timeout)) { 235 + while (1) { 236 236 status = inb(ACBST); 237 237 238 238 /* Reset the status register to avoid the hang */ ··· 242 242 scx200_acb_machine(iface, status); 243 243 return; 244 244 } 245 - yield(); 245 + if (time_after(jiffies, timeout)) 246 + break; 247 + cpu_relax(); 248 + cond_resched(); 246 249 } 247 250 248 251 dev_err(&iface->adapter.dev, "timeout in state %s\n",