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

tty: move some tty-only functions to drivers/tty/tty.h

The flow change and restricted_tty_write() logic is internal to the tty
core only, so move it out of the include/linux/tty.h file.

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

+18 -16
+17
drivers/tty/tty.h
··· 40 40 TTY_LOCK_SLAVE, 41 41 }; 42 42 43 + /* Values for tty->flow_change */ 44 + #define TTY_THROTTLE_SAFE 1 45 + #define TTY_UNTHROTTLE_SAFE 2 46 + 47 + static inline void __tty_set_flow_change(struct tty_struct *tty, int val) 48 + { 49 + tty->flow_change = val; 50 + } 51 + 52 + static inline void tty_set_flow_change(struct tty_struct *tty, int val) 53 + { 54 + tty->flow_change = val; 55 + smp_mb(); 56 + } 57 + 43 58 int tty_ldisc_lock(struct tty_struct *tty, unsigned long timeout); 44 59 void tty_ldisc_unlock(struct tty_struct *tty); 45 60 ··· 71 56 { 72 57 } 73 58 #endif 59 + 60 + ssize_t redirected_tty_write(struct kiocb *, struct iov_iter *); 74 61 75 62 #endif
+1
drivers/tty/tty_ioctl.c
··· 21 21 #include <linux/bitops.h> 22 22 #include <linux/mutex.h> 23 23 #include <linux/compat.h> 24 + #include "tty.h" 24 25 25 26 #include <asm/io.h> 26 27 #include <linux/uaccess.h>
-16
include/linux/tty.h
··· 349 349 #define TTY_LDISC_CHANGING 20 /* Change pending - non-block IO */ 350 350 #define TTY_LDISC_HALTED 22 /* Line discipline is halted */ 351 351 352 - /* Values for tty->flow_change */ 353 - #define TTY_THROTTLE_SAFE 1 354 - #define TTY_UNTHROTTLE_SAFE 2 355 - 356 - static inline void __tty_set_flow_change(struct tty_struct *tty, int val) 357 - { 358 - tty->flow_change = val; 359 - } 360 - 361 - static inline void tty_set_flow_change(struct tty_struct *tty, int val) 362 - { 363 - tty->flow_change = val; 364 - smp_mb(); 365 - } 366 - 367 352 static inline bool tty_io_nonblock(struct tty_struct *tty, struct file *file) 368 353 { 369 354 return file->f_flags & O_NONBLOCK || ··· 380 395 extern struct tty_struct *tty_kopen_shared(dev_t device); 381 396 extern void tty_kclose(struct tty_struct *tty); 382 397 extern int tty_dev_name_to_number(const char *name, dev_t *number); 383 - extern ssize_t redirected_tty_write(struct kiocb *, struct iov_iter *); 384 398 #else 385 399 static inline void tty_kref_put(struct tty_struct *tty) 386 400 { }