Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 207895
b: refs/heads/master
c: a360fae
h: refs/heads/master
i:
  207893: 700733c
  207891: 4043515
  207887: d3abede
v: v3
  • Loading branch information
Alan Cox authored and Greg Kroah-Hartman committed Aug 10, 2010
1 parent afbe103 commit 708031a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4287341d4dba27ef8048f589e3c0bc683c9f2017
refs/heads/master: a360fae67bc173942f620d44d1b23cfb5ccaaf96
12 changes: 11 additions & 1 deletion trunk/drivers/char/synclink_gt.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,12 +675,14 @@ static int open(struct tty_struct *tty, struct file *filp)
goto cleanup;
}

mutex_lock(&info->port.mutex);
info->port.tty->low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;

spin_lock_irqsave(&info->netlock, flags);
if (info->netcount) {
retval = -EBUSY;
spin_unlock_irqrestore(&info->netlock, flags);
mutex_unlock(&info->port.mutex);
goto cleanup;
}
info->port.count++;
Expand All @@ -692,7 +694,7 @@ static int open(struct tty_struct *tty, struct file *filp)
if (retval < 0)
goto cleanup;
}

mutex_unlock(&info->port.mutex);
retval = block_til_ready(tty, filp, info);
if (retval) {
DBGINFO(("%s block_til_ready rc=%d\n", info->device_name, retval));
Expand Down Expand Up @@ -724,12 +726,14 @@ static void close(struct tty_struct *tty, struct file *filp)
if (tty_port_close_start(&info->port, tty, filp) == 0)
goto cleanup;

mutex_lock(&info->port.mutex);
if (info->port.flags & ASYNC_INITIALIZED)
wait_until_sent(tty, info->timeout);
flush_buffer(tty);
tty_ldisc_flush(tty);

shutdown(info);
mutex_unlock(&info->port.mutex);

tty_port_close_end(&info->port, tty);
info->port.tty = NULL;
Expand All @@ -740,17 +744,23 @@ static void close(struct tty_struct *tty, struct file *filp)
static void hangup(struct tty_struct *tty)
{
struct slgt_info *info = tty->driver_data;
unsigned long flags;

if (sanity_check(info, tty->name, "hangup"))
return;
DBGINFO(("%s hangup\n", info->device_name));

flush_buffer(tty);

mutex_lock(&info->port.mutex);
shutdown(info);

spin_lock_irqsave(&info->port.lock, flags);
info->port.count = 0;
info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
info->port.tty = NULL;
spin_unlock_irqrestore(&info->port.lock, flags);
mutex_unlock(&info->port.mutex);

wake_up_interruptible(&info->port.open_wait);
}
Expand Down
9 changes: 8 additions & 1 deletion trunk/drivers/char/synclinkmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -812,13 +812,15 @@ static void close(struct tty_struct *tty, struct file *filp)

if (tty_port_close_start(&info->port, tty, filp) == 0)
goto cleanup;


mutex_lock(&info->port.mutex);
if (info->port.flags & ASYNC_INITIALIZED)
wait_until_sent(tty, info->timeout);

flush_buffer(tty);
tty_ldisc_flush(tty);
shutdown(info);
mutex_unlock(&info->port.mutex);

tty_port_close_end(&info->port, tty);
info->port.tty = NULL;
Expand All @@ -834,6 +836,7 @@ static void close(struct tty_struct *tty, struct file *filp)
static void hangup(struct tty_struct *tty)
{
SLMP_INFO *info = tty->driver_data;
unsigned long flags;

if (debug_level >= DEBUG_LEVEL_INFO)
printk("%s(%d):%s hangup()\n",
Expand All @@ -842,12 +845,16 @@ static void hangup(struct tty_struct *tty)
if (sanity_check(info, tty->name, "hangup"))
return;

mutex_lock(&info->port.mutex);
flush_buffer(tty);
shutdown(info);

spin_lock_irqsave(&info->port.lock, flags);
info->port.count = 0;
info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
info->port.tty = NULL;
spin_unlock_irqrestore(&info->port.lock, flags);
mutex_unlock(&info->port.mutex);

wake_up_interruptible(&info->port.open_wait);
}
Expand Down

0 comments on commit 708031a

Please sign in to comment.