hsi_ffl_tty.c: Do not rely on TTY_THROTTLE when low_latency is set
authorVincent Pillet <vincentx.pillet@intel.com>
Wed, 30 May 2012 12:54:03 +0000 (14:54 +0200)
committerbuildbot <buildbot@intel.com>
Fri, 8 Jun 2012 15:48:00 +0000 (08:48 -0700)
BZ: 35524

As TTY_THROTTLE can be wrong when tty->low_latency is set (rare race condition
identified), we stop relying on this bit. No drawback, as tty_insert_flip_string_flag
will return 0.

Change-Id: Iede1babcaa076cbb450dfafca4ef5266f37210a1
Signed-off-by: Vincent Pillet <vincentx.pillet@intel.com>
Reviewed-on: http://android.intel.com:8080/51986
Reviewed-by: Predon, Frederic <frederic.predon@intel.com>
Reviewed-by: Lebsir, SamiX <samix.lebsir@intel.com>
Tested-by: Lebsir, SamiX <samix.lebsir@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/hsi/clients/hsi_ffl_tty.c

index fbe7092..1cd635e 100644 (file)
@@ -29,6 +29,9 @@
 /* Set the following to use the WAKE post boot handshake */
 #define USE_WAKE_POST_BOOT_HANDSHAKE
 
+/* Set the following to ignore the TTY_THROTTLE bit */
+#define IGNORE_TTY_THROTTLE
+
 #include <linux/log2.h>
 #include <linux/slab.h>
 #include <linux/sched.h>
@@ -1773,6 +1776,13 @@ static void _ffl_forward_tty(struct tty_struct           *tty,
 
                while (frame->actual_len > 0) {
 
+#ifndef IGNORE_TTY_THROTTLE
+                       /* In some rare race condition, we can't rely on
+                        * TTY_THROTTLE bit if low_latency is set.
+                        * The FFL can ignore this bit as
+                        * tty_insert_flip_string_fixed_flag will return 0
+                        * when no more space is left
+                        */
                        if (test_bit(TTY_THROTTLED, &tty->flags)) {
                                /* Initialised to 1 to prevent unexpected TTY
                                 * forwarding resume function schedule */
@@ -1780,7 +1790,7 @@ static void _ffl_forward_tty(struct tty_struct            *tty,
                                _ffl_fifo_wait_push_back(ctx, frame);
                                goto no_more_tty_insert;
                        }
-
+#endif
                        spin_unlock_irqrestore(&ctx->lock, *flags);
 
                        /* Copy the data to the flip buffers */