tty-ldisc: make /proc/tty/ldiscs use ldisc_ops instead of ldiscs
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 3 Aug 2009 23:00:15 +0000 (16:00 -0700)
committerLive-CD User <linux@linux.site>
Sat, 19 Sep 2009 20:13:10 +0000 (13:13 -0700)
commitf0de0e8d3565ee7feba6228d99763d4cea2087a6
tree2fd63db33a1f1e472325a8f4efd9f9b1b87729b0
parent7a4b23104bd2624d16681158a9b338c502c103a0
tty-ldisc: make /proc/tty/ldiscs use ldisc_ops instead of ldiscs

The /proc/tty/ldiscs file is totally and utterly un-interested in the
"struct tty_ldisc" structures, and only cares about the underlying ldisc
operations.

So don't make it create a dummy 'struct ldisc' only to get a pointer to
the operations, and then destroy it.  Instead, we split up the function
'tty_ldisc_try_get()', and create a 'get_ldops()' helper that just looks
up the ldisc operations based on the ldisc number.

That makes the code simpler to read (smaller and more well-defined
helper functions), and allows the /proc functions to avoid creating that
useless dummy only to immediately free it again.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Tested-by: Sergey Senozhatsky <sergey.senozhatsky@mail.by>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/char/tty_ldisc.c