Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *  linux/drivers/char/ttyprintk.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *  Copyright (C) 2010  Samo Pogacnik
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * This pseudo device allows user to make printk messages. It is possible
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * to store "console" messages inline with kernel messages for better analyses
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * of the boot process, for example.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/serial.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/tty.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/spinlock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) struct ttyprintk_port {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	struct tty_port port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	spinlock_t spinlock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) static struct ttyprintk_port tpk_port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * Our simple preformatting supports transparent output of (time-stamped)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * printk messages (also suitable for logging service):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  * - any cr is replaced by nl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  * - adds a ttyprintk source tag in front of each line
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  * - too long message is fragmented, with '\'nl between fragments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  * - TPK_STR_SIZE isn't really the write_room limiting factor, because
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  *   it is emptied on the fly during preformatting.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #define TPK_STR_SIZE 508 /* should be bigger then max expected line length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #define TPK_MAX_ROOM 4096 /* we could assume 4K for instance */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #define TPK_PREFIX KERN_SOH __stringify(CONFIG_TTY_PRINTK_LEVEL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) static int tpk_curr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) static char tpk_buffer[TPK_STR_SIZE + 4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) static void tpk_flush(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	if (tpk_curr > 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 		tpk_buffer[tpk_curr] = '\0';
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 		printk(TPK_PREFIX "[U] %s\n", tpk_buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 		tpk_curr = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) static int tpk_printk(const unsigned char *buf, int count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	int i = tpk_curr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	if (buf == NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 		tpk_flush();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 		return i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	for (i = 0; i < count; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 		if (tpk_curr >= TPK_STR_SIZE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 			/* end of tmp buffer reached: cut the message in two */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 			tpk_buffer[tpk_curr++] = '\\';
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 			tpk_flush();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		switch (buf[i]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 		case '\r':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 			tpk_flush();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 			if ((i + 1) < count && buf[i + 1] == '\n')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 				i++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 		case '\n':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 			tpk_flush();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 		default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 			tpk_buffer[tpk_curr++] = buf[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	return count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)  * TTY operations open function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) static int tpk_open(struct tty_struct *tty, struct file *filp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	tty->driver_data = &tpk_port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	return tty_port_open(&tpk_port.port, tty, filp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98)  * TTY operations close function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) static void tpk_close(struct tty_struct *tty, struct file *filp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	struct ttyprintk_port *tpkp = tty->driver_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	spin_lock_irqsave(&tpkp->spinlock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	/* flush tpk_printk buffer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	tpk_printk(NULL, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	spin_unlock_irqrestore(&tpkp->spinlock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	tty_port_close(&tpkp->port, tty, filp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)  * TTY operations write function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) static int tpk_write(struct tty_struct *tty,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 		const unsigned char *buf, int count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	struct ttyprintk_port *tpkp = tty->driver_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	/* exclusive use of tpk_printk within this tty */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	spin_lock_irqsave(&tpkp->spinlock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	ret = tpk_printk(buf, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	spin_unlock_irqrestore(&tpkp->spinlock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)  * TTY operations write_room function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) static int tpk_write_room(struct tty_struct *tty)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	return TPK_MAX_ROOM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)  * TTY operations ioctl function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) static int tpk_ioctl(struct tty_struct *tty,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 			unsigned int cmd, unsigned long arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	struct ttyprintk_port *tpkp = tty->driver_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	if (!tpkp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	switch (cmd) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	/* Stop TIOCCONS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	case TIOCCONS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 		return -ENOIOCTLCMD;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)  * TTY operations hangup function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) static void tpk_hangup(struct tty_struct *tty)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	struct ttyprintk_port *tpkp = tty->driver_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	tty_port_hangup(&tpkp->port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) static const struct tty_operations ttyprintk_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	.open = tpk_open,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	.close = tpk_close,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	.write = tpk_write,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	.write_room = tpk_write_room,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	.ioctl = tpk_ioctl,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	.hangup = tpk_hangup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) static const struct tty_port_operations null_ops = { };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) static struct tty_driver *ttyprintk_driver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) static int __init ttyprintk_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	spin_lock_init(&tpk_port.spinlock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	ttyprintk_driver = tty_alloc_driver(1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 			TTY_DRIVER_RESET_TERMIOS |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 			TTY_DRIVER_REAL_RAW |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 			TTY_DRIVER_UNNUMBERED_NODE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	if (IS_ERR(ttyprintk_driver))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 		return PTR_ERR(ttyprintk_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	tty_port_init(&tpk_port.port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	tpk_port.port.ops = &null_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	ttyprintk_driver->driver_name = "ttyprintk";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	ttyprintk_driver->name = "ttyprintk";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	ttyprintk_driver->major = TTYAUX_MAJOR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	ttyprintk_driver->minor_start = 3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	ttyprintk_driver->type = TTY_DRIVER_TYPE_CONSOLE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	ttyprintk_driver->init_termios = tty_std_termios;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	ttyprintk_driver->init_termios.c_oflag = OPOST | OCRNL | ONOCR | ONLRET;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	tty_set_operations(ttyprintk_driver, &ttyprintk_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	tty_port_link_device(&tpk_port.port, ttyprintk_driver, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	ret = tty_register_driver(ttyprintk_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 		printk(KERN_ERR "Couldn't register ttyprintk driver\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 		goto error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) error:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	put_tty_driver(ttyprintk_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	tty_port_destroy(&tpk_port.port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) static void __exit ttyprintk_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	tty_unregister_driver(ttyprintk_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	put_tty_driver(ttyprintk_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	tty_port_destroy(&tpk_port.port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) device_initcall(ttyprintk_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) module_exit(ttyprintk_exit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) MODULE_LICENSE("GPL");