Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / tty / n_null.c
blob5a429d923eb31620e12620b6365fca16c3f194c7
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/types.h>
3 #include <linux/errno.h>
4 #include <linux/tty.h>
5 #include <linux/module.h>
7 /*
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)
16 return -EOPNOTSUPP;
19 static ssize_t n_null_write(struct tty_struct *tty, struct file *file,
20 const u8 *buf, size_t nr)
22 return -EOPNOTSUPP;
25 static struct tty_ldisc_ops null_ldisc = {
26 .owner = THIS_MODULE,
27 .num = N_NULL,
28 .name = "n_null",
29 .read = n_null_read,
30 .write = n_null_write,
33 static int __init n_null_init(void)
35 BUG_ON(tty_register_ldisc(&null_ldisc));
36 return 0;
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");