#include <linux/console.h>
#include <linux/device.h>
#include <linux/serial.h>
#include <linux/tty.h>
#include <linux/module.h>
#include <linux/spinlock.h>
struct ttyprintk_port { … };
static struct ttyprintk_port tpk_port;
#define TPK_STR_SIZE …
#define TPK_MAX_ROOM …
#define TPK_PREFIX …
static int tpk_curr;
static u8 tpk_buffer[TPK_STR_SIZE + 4];
static void tpk_flush(void)
{ … }
static int tpk_printk(const u8 *buf, size_t count)
{ … }
static int tpk_open(struct tty_struct *tty, struct file *filp)
{ … }
static void tpk_close(struct tty_struct *tty, struct file *filp)
{ … }
static ssize_t tpk_write(struct tty_struct *tty, const u8 *buf, size_t count)
{ … }
static unsigned int tpk_write_room(struct tty_struct *tty)
{ … }
static void tpk_hangup(struct tty_struct *tty)
{ … }
static void tpk_port_shutdown(struct tty_port *tport)
{ … }
static const struct tty_operations ttyprintk_ops = …;
static const struct tty_port_operations tpk_port_ops = …;
static struct tty_driver *ttyprintk_driver;
static struct tty_driver *ttyprintk_console_device(struct console *c,
int *index)
{ … }
static struct console ttyprintk_console = …;
static int __init ttyprintk_init(void)
{ … }
static void __exit ttyprintk_exit(void)
{ … }
device_initcall(ttyprintk_init);
module_exit(ttyprintk_exit);
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;