Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty: Eliminate global symbol tty_ldisc_N_TTY

Reduce global tty symbols; move and rename tty_ldisc_begin() as
n_tty_init() and redefine the N_TTY ldisc ops as file scope.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Peter Hurley and committed by
Greg Kroah-Hartman
27228732 d1d027ef

+10 -13
+8 -4
drivers/tty/n_tty.c
··· 2497 2497 } 2498 2498 } 2499 2499 2500 - struct tty_ldisc_ops tty_ldisc_N_TTY = { 2500 + static struct tty_ldisc_ops n_tty_ops = { 2501 2501 .magic = TTY_LDISC_MAGIC, 2502 2502 .name = "n_tty", 2503 2503 .open = n_tty_open, ··· 2518 2518 * n_tty_inherit_ops - inherit N_TTY methods 2519 2519 * @ops: struct tty_ldisc_ops where to save N_TTY methods 2520 2520 * 2521 - * Enables a 'subclass' line discipline to 'inherit' N_TTY 2522 - * methods. 2521 + * Enables a 'subclass' line discipline to 'inherit' N_TTY methods. 2523 2522 */ 2524 2523 2525 2524 void n_tty_inherit_ops(struct tty_ldisc_ops *ops) 2526 2525 { 2527 - *ops = tty_ldisc_N_TTY; 2526 + *ops = n_tty_ops; 2528 2527 ops->owner = NULL; 2529 2528 ops->refcount = ops->flags = 0; 2530 2529 } 2531 2530 EXPORT_SYMBOL_GPL(n_tty_inherit_ops); 2531 + 2532 + void __init n_tty_init(void) 2533 + { 2534 + tty_register_ldisc(N_TTY, &n_tty_ops); 2535 + }
+1 -1
drivers/tty/tty_io.c
··· 3576 3576 initcall_t *call; 3577 3577 3578 3578 /* Setup the default TTY line discipline. */ 3579 - tty_ldisc_begin(); 3579 + n_tty_init(); 3580 3580 3581 3581 /* 3582 3582 * set up the console device so that later boot sequences can
-6
drivers/tty/tty_ldisc.c
··· 824 824 tty_ldisc_put(tty->ldisc); 825 825 tty->ldisc = NULL; 826 826 } 827 - 828 - void tty_ldisc_begin(void) 829 - { 830 - /* Setup the default TTY line discipline. */ 831 - (void) tty_register_ldisc(N_TTY, &tty_ldisc_N_TTY); 832 - }
+1 -2
include/linux/tty.h
··· 576 576 extern void tty_ldisc_release(struct tty_struct *tty); 577 577 extern void tty_ldisc_init(struct tty_struct *tty); 578 578 extern void tty_ldisc_deinit(struct tty_struct *tty); 579 - extern void tty_ldisc_begin(void); 580 579 581 580 static inline int tty_ldisc_receive_buf(struct tty_ldisc *ld, unsigned char *p, 582 581 char *f, int count) ··· 592 593 593 594 594 595 /* n_tty.c */ 595 - extern struct tty_ldisc_ops tty_ldisc_N_TTY; 596 596 extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops); 597 + extern void __init n_tty_init(void); 597 598 598 599 /* tty_audit.c */ 599 600 #ifdef CONFIG_AUDIT