Skip to content

Commit c12da96

Browse files
peterhurleygregkh
authored andcommitted
tty: Use 'disc' for line discipline index name
tty->ldisc is a ptr to struct tty_ldisc, but unfortunately 'ldisc' is also used as a parameter or local name to refer to the line discipline index value (ie, N_TTY, N_GSM, etc.); instead prefer the name used by the line discipline registration/ref counting functions. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6ffeb4b commit c12da96

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

drivers/tty/tty_io.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2662,13 +2662,13 @@ static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t _
26622662

26632663
static int tiocsetd(struct tty_struct *tty, int __user *p)
26642664
{
2665-
int ldisc;
2665+
int disc;
26662666
int ret;
26672667

2668-
if (get_user(ldisc, p))
2668+
if (get_user(disc, p))
26692669
return -EFAULT;
26702670

2671-
ret = tty_set_ldisc(tty, ldisc);
2671+
ret = tty_set_ldisc(tty, disc);
26722672

26732673
return ret;
26742674
}

drivers/tty/tty_ldisc.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ EXPORT_SYMBOL_GPL(tty_ldisc_flush);
417417
/**
418418
* tty_set_termios_ldisc - set ldisc field
419419
* @tty: tty structure
420-
* @num: line discipline number
420+
* @disc: line discipline number
421421
*
422422
* This is probably overkill for real world processors but
423423
* they are not on hot paths so a little discipline won't do
@@ -430,10 +430,10 @@ EXPORT_SYMBOL_GPL(tty_ldisc_flush);
430430
* Locking: takes termios_rwsem
431431
*/
432432

433-
static void tty_set_termios_ldisc(struct tty_struct *tty, int num)
433+
static void tty_set_termios_ldisc(struct tty_struct *tty, int disc)
434434
{
435435
down_write(&tty->termios_rwsem);
436-
tty->termios.c_line = num;
436+
tty->termios.c_line = disc;
437437
up_write(&tty->termios_rwsem);
438438

439439
tty->disc_data = NULL;
@@ -531,12 +531,12 @@ static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old)
531531
* the close of one side of a tty/pty pair, and eventually hangup.
532532
*/
533533

534-
int tty_set_ldisc(struct tty_struct *tty, int ldisc)
534+
int tty_set_ldisc(struct tty_struct *tty, int disc)
535535
{
536536
int retval;
537537
struct tty_ldisc *old_ldisc, *new_ldisc;
538538

539-
new_ldisc = tty_ldisc_get(tty, ldisc);
539+
new_ldisc = tty_ldisc_get(tty, disc);
540540
if (IS_ERR(new_ldisc))
541541
return PTR_ERR(new_ldisc);
542542

@@ -551,7 +551,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
551551
}
552552

553553
/* Check the no-op case */
554-
if (tty->ldisc->ops->num == ldisc)
554+
if (tty->ldisc->ops->num == disc)
555555
goto out;
556556

557557
if (test_bit(TTY_HUPPED, &tty->flags)) {
@@ -567,7 +567,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
567567

568568
/* Now set up the new line discipline. */
569569
tty->ldisc = new_ldisc;
570-
tty_set_termios_ldisc(tty, ldisc);
570+
tty_set_termios_ldisc(tty, disc);
571571

572572
retval = tty_ldisc_open(tty, new_ldisc);
573573
if (retval < 0) {
@@ -639,15 +639,15 @@ static void tty_reset_termios(struct tty_struct *tty)
639639
/**
640640
* tty_ldisc_reinit - reinitialise the tty ldisc
641641
* @tty: tty to reinit
642-
* @ldisc: line discipline to reinitialize
642+
* @disc: line discipline to reinitialize
643643
*
644644
* Switch the tty to a line discipline and leave the ldisc
645645
* state closed
646646
*/
647647

648-
static int tty_ldisc_reinit(struct tty_struct *tty, int ldisc)
648+
static int tty_ldisc_reinit(struct tty_struct *tty, int disc)
649649
{
650-
struct tty_ldisc *ld = tty_ldisc_get(tty, ldisc);
650+
struct tty_ldisc *ld = tty_ldisc_get(tty, disc);
651651

652652
if (IS_ERR(ld))
653653
return -1;
@@ -658,7 +658,7 @@ static int tty_ldisc_reinit(struct tty_struct *tty, int ldisc)
658658
* Switch the line discipline back
659659
*/
660660
tty->ldisc = ld;
661-
tty_set_termios_ldisc(tty, ldisc);
661+
tty_set_termios_ldisc(tty, disc);
662662

663663
return 0;
664664
}

include/linux/tty.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ static inline int tty_port_users(struct tty_port *port)
570570

571571
extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc);
572572
extern int tty_unregister_ldisc(int disc);
573-
extern int tty_set_ldisc(struct tty_struct *tty, int ldisc);
573+
extern int tty_set_ldisc(struct tty_struct *tty, int disc);
574574
extern int tty_ldisc_setup(struct tty_struct *tty, struct tty_struct *o_tty);
575575
extern void tty_ldisc_release(struct tty_struct *tty);
576576
extern void tty_ldisc_init(struct tty_struct *tty);

0 commit comments

Comments
 (0)