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

tty: clean include/linux/tty.h up

There are a lot of tty-core-only functions that are listed in
include/linux/tty.h. Move them to drivers/tty/tty.h so that no one else
can accidentally call them or think that they are public functions.

Cc: Jiri Slaby <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20210408125134.3016837-14-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+40 -34
+1
drivers/tty/n_gsm.c
··· 50 50 #include <linux/netdevice.h> 51 51 #include <linux/etherdevice.h> 52 52 #include <linux/gsmmux.h> 53 + #include "tty.h" 53 54 54 55 static int debug; 55 56 module_param(debug, int, 0600);
+1
drivers/tty/n_hdlc.c
··· 100 100 101 101 #include <asm/termios.h> 102 102 #include <linux/uaccess.h> 103 + #include "tty.h" 103 104 104 105 /* 105 106 * Buffers for individual HDLC frames
+37
drivers/tty/tty.h
··· 58 58 int tty_ldisc_lock(struct tty_struct *tty, unsigned long timeout); 59 59 void tty_ldisc_unlock(struct tty_struct *tty); 60 60 61 + int __tty_check_change(struct tty_struct *tty, int sig); 62 + int tty_check_change(struct tty_struct *tty); 63 + void __stop_tty(struct tty_struct *tty); 64 + void __start_tty(struct tty_struct *tty); 65 + void tty_vhangup_session(struct tty_struct *tty); 66 + void tty_open_proc_set_tty(struct file *filp, struct tty_struct *tty); 67 + int tty_signal_session_leader(struct tty_struct *tty, int exit_session); 68 + void session_clear_tty(struct pid *session); 69 + void tty_buffer_free_all(struct tty_port *port); 70 + void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld); 71 + void tty_buffer_init(struct tty_port *port); 72 + void tty_buffer_set_lock_subclass(struct tty_port *port); 73 + bool tty_buffer_restart_work(struct tty_port *port); 74 + bool tty_buffer_cancel_work(struct tty_port *port); 75 + void tty_buffer_flush_work(struct tty_port *port); 76 + speed_t tty_termios_input_baud_rate(struct ktermios *termios); 77 + void tty_ldisc_hangup(struct tty_struct *tty, bool reset); 78 + int tty_ldisc_reinit(struct tty_struct *tty, int disc); 79 + long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg); 80 + long tty_jobctrl_ioctl(struct tty_struct *tty, struct tty_struct *real_tty, 81 + struct file *file, unsigned int cmd, unsigned long arg); 82 + void tty_default_fops(struct file_operations *fops); 83 + struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx); 84 + int tty_alloc_file(struct file *file); 85 + void tty_add_file(struct tty_struct *tty, struct file *file); 86 + void tty_free_file(struct file *file); 87 + int tty_release(struct inode *inode, struct file *filp); 88 + 89 + #define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock)) 90 + 91 + int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty); 92 + void tty_ldisc_release(struct tty_struct *tty); 93 + int __must_check tty_ldisc_init(struct tty_struct *tty); 94 + void tty_ldisc_deinit(struct tty_struct *tty); 95 + 96 + void tty_sysctl_init(void); 97 + 61 98 /* tty_audit.c */ 62 99 #ifdef CONFIG_AUDIT 63 100 void tty_audit_add_data(struct tty_struct *tty, const void *data, size_t size);
+1
drivers/tty/tty_baudrate.c
··· 8 8 #include <linux/termios.h> 9 9 #include <linux/tty.h> 10 10 #include <linux/export.h> 11 + #include "tty.h" 11 12 12 13 13 14 /*
-34
include/linux/tty.h
··· 432 432 433 433 extern const char *tty_driver_name(const struct tty_struct *tty); 434 434 extern void tty_wait_until_sent(struct tty_struct *tty, long timeout); 435 - extern int __tty_check_change(struct tty_struct *tty, int sig); 436 - extern int tty_check_change(struct tty_struct *tty); 437 - extern void __stop_tty(struct tty_struct *tty); 438 435 extern void stop_tty(struct tty_struct *tty); 439 - extern void __start_tty(struct tty_struct *tty); 440 436 extern void start_tty(struct tty_struct *tty); 441 437 extern int tty_register_driver(struct tty_driver *driver); 442 438 extern void tty_unregister_driver(struct tty_driver *driver); ··· 459 463 extern int is_current_pgrp_orphaned(void); 460 464 extern void tty_hangup(struct tty_struct *tty); 461 465 extern void tty_vhangup(struct tty_struct *tty); 462 - extern void tty_vhangup_session(struct tty_struct *tty); 463 466 extern int tty_hung_up_p(struct file *filp); 464 467 extern void do_SAK(struct tty_struct *tty); 465 468 extern void __do_SAK(struct tty_struct *tty); 466 - extern void tty_open_proc_set_tty(struct file *filp, struct tty_struct *tty); 467 - extern int tty_signal_session_leader(struct tty_struct *tty, int exit_session); 468 - extern void session_clear_tty(struct pid *session); 469 469 extern void no_tty(void); 470 - extern void tty_buffer_free_all(struct tty_port *port); 471 - extern void tty_buffer_flush(struct tty_struct *tty, struct tty_ldisc *ld); 472 - extern void tty_buffer_init(struct tty_port *port); 473 - extern void tty_buffer_set_lock_subclass(struct tty_port *port); 474 - extern bool tty_buffer_restart_work(struct tty_port *port); 475 - extern bool tty_buffer_cancel_work(struct tty_port *port); 476 - extern void tty_buffer_flush_work(struct tty_port *port); 477 470 extern speed_t tty_termios_baud_rate(struct ktermios *termios); 478 - extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); 479 471 extern void tty_termios_encode_baud_rate(struct ktermios *termios, 480 472 speed_t ibaud, speed_t obaud); 481 473 extern void tty_encode_baud_rate(struct tty_struct *tty, ··· 491 507 extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *); 492 508 extern void tty_ldisc_deref(struct tty_ldisc *); 493 509 extern struct tty_ldisc *tty_ldisc_ref_wait(struct tty_struct *); 494 - extern void tty_ldisc_hangup(struct tty_struct *tty, bool reset); 495 - extern int tty_ldisc_reinit(struct tty_struct *tty, int disc); 496 510 extern const struct seq_operations tty_ldiscs_seq_ops; 497 511 498 512 extern void tty_wakeup(struct tty_struct *tty); 499 513 extern void tty_ldisc_flush(struct tty_struct *tty); 500 514 501 - extern long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg); 502 515 extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file, 503 516 unsigned int cmd, unsigned long arg); 504 - extern long tty_jobctrl_ioctl(struct tty_struct *tty, struct tty_struct *real_tty, 505 - struct file *file, unsigned int cmd, unsigned long arg); 506 517 extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg); 507 - extern void tty_default_fops(struct file_operations *fops); 508 - extern struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx); 509 - extern int tty_alloc_file(struct file *file); 510 - extern void tty_add_file(struct tty_struct *tty, struct file *file); 511 - extern void tty_free_file(struct file *file); 512 518 extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx); 513 519 extern void tty_release_struct(struct tty_struct *tty, int idx); 514 - extern int tty_release(struct inode *inode, struct file *filp); 515 520 extern void tty_init_termios(struct tty_struct *tty); 516 521 extern void tty_save_termios(struct tty_struct *tty); 517 522 extern int tty_standard_install(struct tty_driver *driver, 518 523 struct tty_struct *tty); 519 524 520 525 extern struct mutex tty_mutex; 521 - 522 - #define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock)) 523 526 524 527 extern void tty_port_init(struct tty_port *port); 525 528 extern void tty_port_link_device(struct tty_port *port, ··· 627 656 extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc); 628 657 extern int tty_unregister_ldisc(int disc); 629 658 extern int tty_set_ldisc(struct tty_struct *tty, int disc); 630 - extern int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty); 631 - extern void tty_ldisc_release(struct tty_struct *tty); 632 - extern int __must_check tty_ldisc_init(struct tty_struct *tty); 633 - extern void tty_ldisc_deinit(struct tty_struct *tty); 634 659 extern int tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p, 635 660 char *f, int count); 636 - extern void tty_sysctl_init(void); 637 661 638 662 /* n_tty.c */ 639 663 extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops);