aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/tty/tty_ioctl.c14
-rw-r--r--include/linux/tty.h1
2 files changed, 10 insertions, 5 deletions
diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
index 0c1889971459..1a1135d580a2 100644
--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -486,7 +486,7 @@ int tty_termios_hw_change(struct ktermios *a, struct ktermios *b)
486EXPORT_SYMBOL(tty_termios_hw_change); 486EXPORT_SYMBOL(tty_termios_hw_change);
487 487
488/** 488/**
489 * change_termios - update termios values 489 * tty_set_termios - update termios values
490 * @tty: tty to update 490 * @tty: tty to update
491 * @new_termios: desired new value 491 * @new_termios: desired new value
492 * 492 *
@@ -497,7 +497,7 @@ EXPORT_SYMBOL(tty_termios_hw_change);
497 * Locking: termios_mutex 497 * Locking: termios_mutex
498 */ 498 */
499 499
500static void change_termios(struct tty_struct *tty, struct ktermios *new_termios) 500int tty_set_termios(struct tty_struct *tty, struct ktermios *new_termios)
501{ 501{
502 struct ktermios old_termios; 502 struct ktermios old_termios;
503 struct tty_ldisc *ld; 503 struct tty_ldisc *ld;
@@ -553,7 +553,9 @@ static void change_termios(struct tty_struct *tty, struct ktermios *new_termios)
553 tty_ldisc_deref(ld); 553 tty_ldisc_deref(ld);
554 } 554 }
555 mutex_unlock(&tty->termios_mutex); 555 mutex_unlock(&tty->termios_mutex);
556 return 0;
556} 557}
558EXPORT_SYMBOL_GPL(tty_set_termios);
557 559
558/** 560/**
559 * set_termios - set termios values for a tty 561 * set_termios - set termios values for a tty
@@ -562,7 +564,7 @@ static void change_termios(struct tty_struct *tty, struct ktermios *new_termios)
562 * @opt: option information 564 * @opt: option information
563 * 565 *
564 * Helper function to prepare termios data and run necessary other 566 * Helper function to prepare termios data and run necessary other
565 * functions before using change_termios to do the actual changes. 567 * functions before using tty_set_termios to do the actual changes.
566 * 568 *
567 * Locking: 569 * Locking:
568 * Called functions take ldisc and termios_mutex locks 570 * Called functions take ldisc and termios_mutex locks
@@ -620,7 +622,7 @@ static int set_termios(struct tty_struct *tty, void __user *arg, int opt)
620 return -EINTR; 622 return -EINTR;
621 } 623 }
622 624
623 change_termios(tty, &tmp_termios); 625 tty_set_termios(tty, &tmp_termios);
624 626
625 /* FIXME: Arguably if tmp_termios == tty->termios AND the 627 /* FIXME: Arguably if tmp_termios == tty->termios AND the
626 actual requested termios was not tmp_termios then we may 628 actual requested termios was not tmp_termios then we may
@@ -797,7 +799,7 @@ static int set_sgttyb(struct tty_struct *tty, struct sgttyb __user *sgttyb)
797 termios.c_ospeed); 799 termios.c_ospeed);
798#endif 800#endif
799 mutex_unlock(&tty->termios_mutex); 801 mutex_unlock(&tty->termios_mutex);
800 change_termios(tty, &termios); 802 tty_set_termios(tty, &termios);
801 return 0; 803 return 0;
802} 804}
803#endif 805#endif
@@ -951,6 +953,8 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
951 int ret = 0; 953 int ret = 0;
952 struct ktermios kterm; 954 struct ktermios kterm;
953 955
956 BUG_ON(file == NULL);
957
954 if (tty->driver->type == TTY_DRIVER_TYPE_PTY && 958 if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
955 tty->driver->subtype == PTY_TYPE_MASTER) 959 tty->driver->subtype == PTY_TYPE_MASTER)
956 real_tty = tty->link; 960 real_tty = tty->link;
diff --git a/include/linux/tty.h b/include/linux/tty.h
index ef1e0123573b..4e53d4641b38 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -448,6 +448,7 @@ extern void tty_encode_baud_rate(struct tty_struct *tty,
448 speed_t ibaud, speed_t obaud); 448 speed_t ibaud, speed_t obaud);
449extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); 449extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old);
450extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); 450extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b);
451extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt);
451 452
452extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *); 453extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *);
453extern void tty_ldisc_deref(struct tty_ldisc *); 454extern void tty_ldisc_deref(struct tty_ldisc *);