1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/types.h>
3 #include <linux/errno.h>
5 #include <linux/module.h>
8 * n_null.c - Null line discipline used in the failure path
10 * Copyright (C) Intel 2017
13 static ssize_t
n_null_read(struct tty_struct
*tty
, struct file
*file
, u8
*buf
,
14 size_t nr
, void **cookie
, unsigned long offset
)
19 static ssize_t
n_null_write(struct tty_struct
*tty
, struct file
*file
,
20 const u8
*buf
, size_t nr
)
25 static struct tty_ldisc_ops null_ldisc
= {
30 .write
= n_null_write
,
33 static int __init
n_null_init(void)
35 BUG_ON(tty_register_ldisc(&null_ldisc
));
39 static void __exit
n_null_exit(void)
41 tty_unregister_ldisc(&null_ldisc
);
44 module_init(n_null_init
);
45 module_exit(n_null_exit
);
47 MODULE_LICENSE("GPL");
48 MODULE_AUTHOR("Alan Cox");
49 MODULE_ALIAS_LDISC(N_NULL
);
50 MODULE_DESCRIPTION("Null ldisc driver");