Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 156374
b: refs/heads/master
c: cbe9352
h: refs/heads/master
v: v3
  • Loading branch information
Linus Torvalds authored and Greg Kroah-Hartman committed Aug 4, 2009
1 parent 716929e commit 6d6eb57
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 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: 65b770468e98941e45e19780dff9283e663e6b8b
refs/heads/master: cbe9352fa08f90aa03b4dbf1bbabfc95d196e562
17 changes: 12 additions & 5 deletions trunk/drivers/char/tty_ldisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,32 @@ static inline struct tty_ldisc *get_ldisc(struct tty_ldisc *ld)
return ld;
}

static inline void put_ldisc(struct tty_ldisc *ld)
static void put_ldisc(struct tty_ldisc *ld)
{
unsigned long flags;

if (WARN_ON_ONCE(!ld))
return;

/*
* If this is the last user, free the ldisc, and
* release the ldisc ops.
*
* We really want an "atomic_dec_and_lock_irqsave()",
* but we don't have it, so this does it by hand.
*/
if (atomic_dec_and_test(&ld->users)) {
unsigned long flags;
local_irq_save(flags);
if (atomic_dec_and_lock(&ld->users, &tty_ldisc_lock)) {
struct tty_ldisc_ops *ldo = ld->ops;

kfree(ld);
spin_lock_irqsave(&tty_ldisc_lock, flags);
ldo->refcount--;
module_put(ldo->owner);
spin_unlock_irqrestore(&tty_ldisc_lock, flags);

kfree(ld);
return;
}
local_irq_restore(flags);
}

/**
Expand Down

0 comments on commit 6d6eb57

Please sign in to comment.