Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 163833
b: refs/heads/master
c: b50989d
h: refs/heads/master
i:
  163831: bc9ce88
v: v3
  • Loading branch information
Alan Cox authored and Live-CD User committed Sep 19, 2009
1 parent c709457 commit 6c5ab92
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 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: e936ffd5cb2b4c7ee04925c9b92b616c01f1e022
refs/heads/master: b50989dc444599c8b21edc23536fc305f4e9b7d5
19 changes: 16 additions & 3 deletions trunk/drivers/char/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1386,10 +1386,14 @@ EXPORT_SYMBOL(tty_shutdown);
* tty_mutex - sometimes only
* takes the file list lock internally when working on the list
* of ttys that the driver keeps.
*
* This method gets called from a work queue so that the driver private
* shutdown ops can sleep (needed for USB at least)
*/
static void release_one_tty(struct kref *kref)
static void release_one_tty(struct work_struct *work)
{
struct tty_struct *tty = container_of(kref, struct tty_struct, kref);
struct tty_struct *tty =
container_of(work, struct tty_struct, hangup_work);
struct tty_driver *driver = tty->driver;

if (tty->ops->shutdown)
Expand All @@ -1407,6 +1411,15 @@ static void release_one_tty(struct kref *kref)
free_tty_struct(tty);
}

static void queue_release_one_tty(struct kref *kref)
{
struct tty_struct *tty = container_of(kref, struct tty_struct, kref);
/* The hangup queue is now free so we can reuse it rather than
waste a chunk of memory for each port */
INIT_WORK(&tty->hangup_work, release_one_tty);
schedule_work(&tty->hangup_work);
}

/**
* tty_kref_put - release a tty kref
* @tty: tty device
Expand All @@ -1418,7 +1431,7 @@ static void release_one_tty(struct kref *kref)
void tty_kref_put(struct tty_struct *tty)
{
if (tty)
kref_put(&tty->kref, release_one_tty);
kref_put(&tty->kref, queue_release_one_tty);
}
EXPORT_SYMBOL(tty_kref_put);

Expand Down

0 comments on commit 6c5ab92

Please sign in to comment.