From: Hendrik Brueckner Date: Mon, 13 Oct 2008 23:12:50 +0000 (+0000) Subject: hvc_console: Fix loop if put_char() returns 0 X-Git-Tag: v2.6.28-rc1~58^2~8 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3feebbb5492e9e463467cefb633e23a3dfcec132;p=pandora-kernel.git hvc_console: Fix loop if put_char() returns 0 If put_char() routine of a hvc console backend returns 0, then the hvc console starts looping in the following scenarios: 1. hvc_console_print() If put_char() returns 0 then the while loop may loop forever. I have added the missing check for 0 to throw away console messages. 2. khvcd may loop: The thread calls hvc_poll() --> hvc_push()... if there are still buffered data then the HVC_POLL_WRITE bit is set and causes the khvcd thread to loop (if yield() returns immediately). However, instead of looping, the khvcd thread could sleep for MIN_TIMEOUT (doing the same as for get_chars()). The MIN_TIMEOUT is set if hvc_push() was not able to write data to the backend. If data has been written, the timeout is set to 0 to immediately re-schedule hvc_poll(). Reviewed-by: Christian Borntraeger Tested-by: Christian Borntraeger (virtio_console) Signed-off-by: Hendrik Brueckner Signed-off-by: Benjamin Herrenschmidt --- Reading git-diff-tree failed