msm: smd_tty: Reset the open flag in close operation
The open flag in each SMD tty device is not reset during the close
operation. When the SMD tty device is closed and reopened quickly,
this leads to the completion of open operation even though the
underlying SMD channel is not open completely. Hence the few
initial operations on the SMD tty device fails. The open flag is
reset during the close operation, so that the successive open operation
waits until the underlying SMD channel is open completely.
Change-Id: I6c154a3c0fc9d084d4374c696fe05b8593999cf9
CRs-Fixed: 318810
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
diff --git a/arch/arm/mach-msm/smd_tty.c b/arch/arm/mach-msm/smd_tty.c
index 6f151cb..76a02b0 100644
--- a/arch/arm/mach-msm/smd_tty.c
+++ b/arch/arm/mach-msm/smd_tty.c
@@ -323,12 +323,16 @@
static void smd_tty_close(struct tty_struct *tty, struct file *f)
{
struct smd_tty_info *info = tty->driver_data;
+ unsigned long flags;
if (info == 0)
return;
mutex_lock(&smd_tty_lock);
if (--info->open_count == 0) {
+ spin_lock_irqsave(&info->reset_lock, flags);
+ info->is_open = 0;
+ spin_unlock_irqrestore(&info->reset_lock, flags);
if (info->tty) {
tasklet_kill(&info->tty_tsklt);
wake_lock_destroy(&info->wake_lock);