tty: remove TTY_LDISC_MAGIC
authorJiri Slaby <jslaby@suse.cz>
Tue, 2 Mar 2021 06:21:38 +0000 (07:21 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Mar 2021 08:34:06 +0000 (09:34 +0100)
First, it is never checked. Second, use of it as a debugging aid is
at least questionable. With the current tools, I don't think anyone used
this kind of thing for debugging purposes for years.

On the top of that, e.g. serdev does not set this field of tty_ldisc_ops
at all.

So get rid of this legacy.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210302062214.29627-8-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23 files changed:
Documentation/process/magic-number.rst
Documentation/translations/it_IT/process/magic-number.rst
Documentation/translations/zh_CN/process/magic-number.rst
drivers/accessibility/speakup/spk_ttyio.c
drivers/bluetooth/hci_ldisc.c
drivers/misc/ti-st/st_core.c
drivers/net/caif/caif_serial.c
drivers/net/can/slcan.c
drivers/net/hamradio/6pack.c
drivers/net/hamradio/mkiss.c
drivers/net/ppp/ppp_async.c
drivers/net/ppp/ppp_synctty.c
drivers/net/slip/slip.c
drivers/pps/clients/pps-ldisc.c
drivers/tty/n_gsm.c
drivers/tty/n_hdlc.c
drivers/tty/n_null.c
drivers/tty/n_r3964.c
drivers/tty/n_tty.c
include/linux/tty_ldisc.h
net/nfc/nci/uart.c
sound/soc/codecs/cx20442.c
sound/soc/ti/ams-delta.c

index 89992fe4863f3574e34f65bbb2f55735a9a67d55..f5ba36e964617dd68cf120f3c831f9658f6add84 100644 (file)
@@ -88,7 +88,6 @@ TTY_MAGIC             0x5401           tty_struct               ``include/linux/
 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``
-TTY_LDISC_MAGIC       0x5403           tty_ldisc                ``include/linux/tty_ldisc.h``
 USB_SERIAL_MAGIC      0x6702           usb_serial               ``drivers/usb/serial/usb-serial.h``
 FULL_DUPLEX_MAGIC     0x6969                                    ``drivers/net/ethernet/dec/tulip/de2104x.c``
 USB_BLUETOOTH_MAGIC   0x6d02           usb_bluetooth            ``drivers/usb/class/bluetty.c``
index 9be170ec0d023e9edf22005525435a2c72778433..e8c782d155a32de7a8b5f17c53d63d6f364cb723 100644 (file)
@@ -94,7 +94,6 @@ TTY_MAGIC             0x5401           tty_struct               ``include/linux/
 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``
-TTY_LDISC_MAGIC       0x5403           tty_ldisc                ``include/linux/tty_ldisc.h``
 USB_SERIAL_MAGIC      0x6702           usb_serial               ``drivers/usb/serial/usb-serial.h``
 FULL_DUPLEX_MAGIC     0x6969                                    ``drivers/net/ethernet/dec/tulip/de2104x.c``
 USB_BLUETOOTH_MAGIC   0x6d02           usb_bluetooth            ``drivers/usb/class/bluetty.c``
index 191d705349ef36e9328014168e3459a1802db3c4..42f0635ca70a54ba803cdd2a15b1e5847c000b18 100644 (file)
@@ -77,7 +77,6 @@ TTY_MAGIC             0x5401           tty_struct               ``include/linux/
 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``
-TTY_LDISC_MAGIC       0x5403           tty_ldisc                ``include/linux/tty_ldisc.h``
 USB_SERIAL_MAGIC      0x6702           usb_serial               ``drivers/usb/serial/usb-serial.h``
 FULL_DUPLEX_MAGIC     0x6969                                    ``drivers/net/ethernet/dec/tulip/de2104x.c``
 USB_BLUETOOTH_MAGIC   0x6d02           usb_bluetooth            ``drivers/usb/class/bluetty.c``
index 9af1d4c124d378d312e943c260c43afd426c8156..2e39fcf492d8bd8d1b0e09a5887714ba38645b15 100644 (file)
@@ -104,7 +104,6 @@ static int spk_ttyio_receive_buf2(struct tty_struct *tty,
 
 static struct tty_ldisc_ops spk_ttyio_ldisc_ops = {
        .owner          = THIS_MODULE,
-       .magic          = TTY_LDISC_MAGIC,
        .name           = "speakup_ldisc",
        .open           = spk_ttyio_ldisc_open,
        .close          = spk_ttyio_ldisc_close,
index 637c5b8c2aa1a545c1b07a16df3b196489149144..71a4ca505e09e6b339d56940663ccd892a733ed1 100644 (file)
@@ -821,7 +821,6 @@ static __poll_t hci_uart_tty_poll(struct tty_struct *tty,
 
 static struct tty_ldisc_ops hci_uart_ldisc = {
        .owner          = THIS_MODULE,
-       .magic          = TTY_LDISC_MAGIC,
        .name           = "n_hci",
        .open           = hci_uart_tty_open,
        .close          = hci_uart_tty_close,
index 5a0a5fc3d3abca6536af520e47b9e4505f2ad48d..071844b58073929e3a7247dbfebfbfff0a7f480b 100644 (file)
@@ -845,7 +845,6 @@ static void st_tty_flush_buffer(struct tty_struct *tty)
 }
 
 static struct tty_ldisc_ops st_ldisc_ops = {
-       .magic = TTY_LDISC_MAGIC,
        .name = "n_st",
        .open = st_tty_open,
        .close = st_tty_close,
index 8215cd77301f5430c8deeecf9553fefda859a382..675c374b32eebd47edc92531ca639e652df4f60f 100644 (file)
@@ -382,7 +382,6 @@ static void ldisc_close(struct tty_struct *tty)
 /* The line discipline structure. */
 static struct tty_ldisc_ops caif_ldisc = {
        .owner =        THIS_MODULE,
-       .magic =        TTY_LDISC_MAGIC,
        .name =         "n_caif",
        .open =         ldisc_open,
        .close =        ldisc_close,
index 30c8d53c9745d7b9253eb8dc6b1c8151daf9a328..31ba6664503d3558e917d188cdaf02f58be1a369 100644 (file)
@@ -697,7 +697,6 @@ static int slcan_ioctl(struct tty_struct *tty, struct file *file,
 
 static struct tty_ldisc_ops slc_ldisc = {
        .owner          = THIS_MODULE,
-       .magic          = TTY_LDISC_MAGIC,
        .name           = "slcan",
        .open           = slcan_open,
        .close          = slcan_close,
index 71d6629e65c970e7e133cfa615aa01341a68d43f..6f71eff9c52e1fd6caba4c352b279837366b76c0 100644 (file)
@@ -749,7 +749,6 @@ static int sixpack_ioctl(struct tty_struct *tty, struct file *file,
 
 static struct tty_ldisc_ops sp_ldisc = {
        .owner          = THIS_MODULE,
-       .magic          = TTY_LDISC_MAGIC,
        .name           = "6pack",
        .open           = sixpack_open,
        .close          = sixpack_close,
index 17be2bb2985cd00ab965f072762c1ff7e3f6da93..65154224d5b840c50486941000ad36a5f3bcc2be 100644 (file)
@@ -933,7 +933,6 @@ out:
 
 static struct tty_ldisc_ops ax_ldisc = {
        .owner          = THIS_MODULE,
-       .magic          = TTY_LDISC_MAGIC,
        .name           = "mkiss",
        .open           = mkiss_open,
        .close          = mkiss_close,
index 2a91caa4f37b075d77da8d085a03145afddd2d1e..8b41aa3fb64eaa409cc8fee66f143225233c5d06 100644 (file)
@@ -372,7 +372,6 @@ ppp_asynctty_wakeup(struct tty_struct *tty)
 
 static struct tty_ldisc_ops ppp_ldisc = {
        .owner  = THIS_MODULE,
-       .magic  = TTY_LDISC_MAGIC,
        .name   = "ppp",
        .open   = ppp_asynctty_open,
        .close  = ppp_asynctty_close,
index d8890923a9e33abecf1668c399410a9ccdcd3a03..576b6a93bf23b2426c24b1dcae8a5cd3e2b373cc 100644 (file)
@@ -365,7 +365,6 @@ ppp_sync_wakeup(struct tty_struct *tty)
 
 static struct tty_ldisc_ops ppp_sync_ldisc = {
        .owner  = THIS_MODULE,
-       .magic  = TTY_LDISC_MAGIC,
        .name   = "pppsync",
        .open   = ppp_sync_open,
        .close  = ppp_sync_close,
index f81fb0b13a944f6a51d2b5be6135b14055b9f9db..1ab124eba8eb5d0f7f51d4c8e4195e6cc8060bec 100644 (file)
@@ -1263,7 +1263,6 @@ static int sl_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 
 static struct tty_ldisc_ops sl_ldisc = {
        .owner          = THIS_MODULE,
-       .magic          = TTY_LDISC_MAGIC,
        .name           = "slip",
        .open           = slip_open,
        .close          = slip_close,
index 4fd0cbf7f93180ede539706f59828963831a4f6e..bf26cc56b863a471d369dd9b9e7165a7546b2dee 100644 (file)
@@ -13,8 +13,6 @@
 #include <linux/pps_kernel.h>
 #include <linux/bug.h>
 
-#define PPS_TTY_MAGIC          0x0001
-
 static void pps_tty_dcd_change(struct tty_struct *tty, unsigned int status)
 {
        struct pps_device *pps;
@@ -114,7 +112,6 @@ static int __init pps_tty_init(void)
 
        /* Init PPS_TTY data */
        pps_ldisc_ops.owner = THIS_MODULE;
-       pps_ldisc_ops.magic = PPS_TTY_MAGIC;
        pps_ldisc_ops.name = "pps_tty";
        pps_ldisc_ops.dcd_change = pps_tty_dcd_change;
        pps_ldisc_ops.open = pps_tty_open;
index 51dafc06f5414d9e59f2b68400715b5b8afdbc88..b063bc608a8ca21ae19436686d774a2b4920eae9 100644 (file)
@@ -2849,7 +2849,6 @@ static int gsm_create_network(struct gsm_dlci *dlci, struct gsm_netconfig *nc)
 /* Line discipline for real tty */
 static struct tty_ldisc_ops tty_ldisc_packet = {
        .owner           = THIS_MODULE,
-       .magic           = TTY_LDISC_MAGIC,
        .name            = "n_gsm",
        .open            = gsmld_open,
        .close           = gsmld_close,
index 1363e659dc1dbce8f08983e0f1c439555640006b..290c757db1b99778955fe05c60eb4a8fd4e2f6e1 100644 (file)
@@ -787,7 +787,6 @@ static struct n_hdlc_buf *n_hdlc_buf_get(struct n_hdlc_buf_list *buf_list)
 
 static struct tty_ldisc_ops n_hdlc_ldisc = {
        .owner          = THIS_MODULE,
-       .magic          = TTY_LDISC_MAGIC,
        .name           = "hdlc",
        .open           = n_hdlc_tty_open,
        .close          = n_hdlc_tty_close,
index ce03ae78f5c6ac40a6fe2e1278b049fbc1d7edbe..b8f67b5f1ef88023c511d61aefd4f81b31923683 100644 (file)
@@ -40,7 +40,6 @@ static void n_null_receivebuf(struct tty_struct *tty,
 
 static struct tty_ldisc_ops null_ldisc = {
        .owner          =       THIS_MODULE,
-       .magic          =       TTY_LDISC_MAGIC,
        .name           =       "n_null",
        .open           =       n_null_open,
        .close          =       n_null_close,
index 3161f0a535e3714d1aad14cb8ffc39b606f05fd9..2eb76ea1d88dd7fb00250b6f2ae11fa784baa4d8 100644 (file)
@@ -146,7 +146,6 @@ static void r3964_receive_buf(struct tty_struct *tty, const unsigned char *cp,
 
 static struct tty_ldisc_ops tty_ldisc_N_R3964 = {
        .owner = THIS_MODULE,
-       .magic = TTY_LDISC_MAGIC,
        .name = "R3964",
        .open = r3964_open,
        .close = r3964_close,
index 87ec15dbe10db355dbe1b760fe65eeddb4ce99fc..7c53185bce5762e8c647e3d139fbcae17de17b2b 100644 (file)
@@ -2488,7 +2488,6 @@ static int n_tty_ioctl(struct tty_struct *tty, struct file *file,
 }
 
 static struct tty_ldisc_ops n_tty_ops = {
-       .magic           = TTY_LDISC_MAGIC,
        .name            = "n_tty",
        .open            = n_tty_open,
        .close           = n_tty_close,
index 572a0797611659d25ebcfe9f5966adc4523b28b2..31284b55bd4f148953c43c243caebb44509d4899 100644 (file)
@@ -173,7 +173,6 @@ extern int ldsem_down_write_nested(struct ld_semaphore *sem, int subclass,
 
 
 struct tty_ldisc_ops {
-       int     magic;
        char    *name;
        int     num;
        int     flags;
@@ -218,8 +217,6 @@ struct tty_ldisc {
        struct tty_struct *tty;
 };
 
-#define TTY_LDISC_MAGIC        0x5403
-
 #define LDISC_FLAG_DEFINED     0x00000001
 
 #define MODULE_ALIAS_LDISC(ldisc) \
index 1204c438e87dc5ce92200f39f9888615923bb96b..16d009c9b6a031d12b531cd7e39712c1cb325875 100644 (file)
@@ -453,7 +453,6 @@ void nci_uart_set_config(struct nci_uart *nu, int baudrate, int flow_ctrl)
 EXPORT_SYMBOL_GPL(nci_uart_set_config);
 
 static struct tty_ldisc_ops nci_uart_ldisc = {
-       .magic          = TTY_LDISC_MAGIC,
        .owner          = THIS_MODULE,
        .name           = "n_nci",
        .open           = nci_uart_tty_open,
index 161be8b7d1317b0825b61ce18c6f44431f641d06..61dfa86d444d81ee439f8b7311b98b95f28e08ad 100644 (file)
@@ -285,7 +285,6 @@ static void v253_wakeup(struct tty_struct *tty)
 }
 
 struct tty_ldisc_ops v253_ops = {
-       .magic = TTY_LDISC_MAGIC,
        .name = "cx20442",
        .owner = THIS_MODULE,
        .open = v253_open,
index 57feb473a579caa89a697b90da48d7ba7d426f30..98198c7cc872d32e14f3b03c0c959d2b0fb22fc5 100644 (file)
@@ -395,7 +395,6 @@ static void cx81801_wakeup(struct tty_struct *tty)
 }
 
 static struct tty_ldisc_ops cx81801_ops = {
-       .magic = TTY_LDISC_MAGIC,
        .name = "cx81801",
        .owner = THIS_MODULE,
        .open = cx81801_open,