Commit 7a4e0d2c authored by наб's avatar наб Committed by Greg Kroah-Hartman
Browse files

tty: remove TTY_MAGIC



According to Greg, in the context of magic numbers as defined in
magic-number.rst, "the tty layer should not need this and I'll gladly
take patches"

Acked-by: default avatarJiri Slaby <jirislaby@kernel.org>
Signed-off-by: default avatarAhelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Ref: https://lore.kernel.org/linux-doc/YyMlovoskUcHLEb7@kroah.com/
Link: https://lore.kernel.org/r/476d024cd6b04160a5de381ea2b9856b60088cbd.1663288066.git.nabijaczleweli@nabijaczleweli.xyz


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1d5859ef
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -84,7 +84,6 @@ SLIP_MAGIC 0x5302 slip ``drivers/net/sl
STRIP_MAGIC           0x5303           strip                    ``drivers/net/strip.c``
SIXPACK_MAGIC         0x5304           sixpack                  ``drivers/net/hamradio/6pack.h``
AX25_MAGIC            0x5316           ax_disp                  ``drivers/net/mkiss.h``
TTY_MAGIC             0x5401           tty_struct               ``include/linux/tty.h``
MGSL_MAGIC            0x5401           mgsl_info                ``drivers/char/synclink.c``
TTY_DRIVER_MAGIC      0x5402           tty_driver               ``include/linux/tty_driver.h``
MGSLPC_MAGIC          0x5402           mgslpc_info              ``drivers/char/pcmcia/synclink_cs.c``
+0 −1
Original line number Diff line number Diff line
@@ -90,7 +90,6 @@ SLIP_MAGIC 0x5302 slip ``drivers/net/sl
STRIP_MAGIC           0x5303           strip                    ``drivers/net/strip.c``
SIXPACK_MAGIC         0x5304           sixpack                  ``drivers/net/hamradio/6pack.h``
AX25_MAGIC            0x5316           ax_disp                  ``drivers/net/mkiss.h``
TTY_MAGIC             0x5401           tty_struct               ``include/linux/tty.h``
MGSL_MAGIC            0x5401           mgsl_info                ``drivers/char/synclink.c``
TTY_DRIVER_MAGIC      0x5402           tty_driver               ``include/linux/tty_driver.h``
MGSLPC_MAGIC          0x5402           mgslpc_info              ``drivers/char/pcmcia/synclink_cs.c``
+0 −1
Original line number Diff line number Diff line
@@ -73,7 +73,6 @@ SLIP_MAGIC 0x5302 slip ``drivers/net/sl
STRIP_MAGIC           0x5303           strip                    ``drivers/net/strip.c``
SIXPACK_MAGIC         0x5304           sixpack                  ``drivers/net/hamradio/6pack.h``
AX25_MAGIC            0x5316           ax_disp                  ``drivers/net/mkiss.h``
TTY_MAGIC             0x5401           tty_struct               ``include/linux/tty.h``
MGSL_MAGIC            0x5401           mgsl_info                ``drivers/char/synclink.c``
TTY_DRIVER_MAGIC      0x5402           tty_driver               ``include/linux/tty_driver.h``
MGSLPC_MAGIC          0x5402           mgslpc_info              ``drivers/char/pcmcia/synclink_cs.c``
+0 −1
Original line number Diff line number Diff line
@@ -76,7 +76,6 @@ SLIP_MAGIC 0x5302 slip ``drivers/net/sl
STRIP_MAGIC           0x5303           strip                    ``drivers/net/strip.c``
SIXPACK_MAGIC         0x5304           sixpack                  ``drivers/net/hamradio/6pack.h``
AX25_MAGIC            0x5316           ax_disp                  ``drivers/net/mkiss.h``
TTY_MAGIC             0x5401           tty_struct               ``include/linux/tty.h``
MGSL_MAGIC            0x5401           mgsl_info                ``drivers/char/synclink.c``
TTY_DRIVER_MAGIC      0x5402           tty_driver               ``include/linux/tty_driver.h``
MGSLPC_MAGIC          0x5402           mgslpc_info              ``drivers/char/pcmcia/synclink_cs.c``
+0 −8
Original line number Diff line number Diff line
@@ -170,7 +170,6 @@ static void free_tty_struct(struct tty_struct *tty)
	tty_ldisc_deinit(tty);
	put_device(tty->dev);
	kvfree(tty->write_buf);
	tty->magic = 0xDEADDEAD;
	kfree(tty);
}

@@ -265,11 +264,6 @@ static int tty_paranoia_check(struct tty_struct *tty, struct inode *inode,
			imajor(inode), iminor(inode), routine);
		return 1;
	}
	if (tty->magic != TTY_MAGIC) {
		pr_warn("(%d:%d): %s: bad magic number\n",
			imajor(inode), iminor(inode), routine);
		return 1;
	}
#endif
	return 0;
}
@@ -1533,7 +1527,6 @@ static void release_one_tty(struct work_struct *work)
	if (tty->ops->cleanup)
		tty->ops->cleanup(tty);

	tty->magic = 0;
	tty_driver_kref_put(driver);
	module_put(owner);

@@ -3093,7 +3086,6 @@ struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx)
		return NULL;

	kref_init(&tty->kref);
	tty->magic = TTY_MAGIC;
	if (tty_ldisc_init(tty)) {
		kfree(tty);
		return NULL;
Loading