diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-08-08 16:26:43 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-08-13 19:45:38 -0400 |
commit | 0019b4089ccef8148d8be83cc8adfc81a75b47d4 (patch) | |
tree | 4db275fb4c29f9e7f2da85f136dc9f733b26d3eb /drivers/char | |
parent | 16a02081baa15becdb7d6460659e7832e6524d93 (diff) |
TTY: add support for unnumbered device nodes
This allows drivers like ttyprintk to avoid hacks to create an
unnumbered node in /dev. It used to set TTY_DRIVER_DYNAMIC_DEV in
flags and call device_create on its own. That is incorrect, because
TTY_DRIVER_DYNAMIC_DEV may be set only if tty_register_device is
called explicitly.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/ttyprintk.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c index be1c3fb186c..9e6272f0b98 100644 --- a/drivers/char/ttyprintk.c +++ b/drivers/char/ttyprintk.c | |||
@@ -178,13 +178,15 @@ static struct tty_driver *ttyprintk_driver; | |||
178 | static int __init ttyprintk_init(void) | 178 | static int __init ttyprintk_init(void) |
179 | { | 179 | { |
180 | int ret = -ENOMEM; | 180 | int ret = -ENOMEM; |
181 | void *rp; | ||
182 | 181 | ||
183 | tty_port_init(&tpk_port.port); | 182 | tty_port_init(&tpk_port.port); |
184 | tpk_port.port.ops = &null_ops; | 183 | tpk_port.port.ops = &null_ops; |
185 | mutex_init(&tpk_port.port_write_mutex); | 184 | mutex_init(&tpk_port.port_write_mutex); |
186 | 185 | ||
187 | ttyprintk_driver = alloc_tty_driver(1); | 186 | ttyprintk_driver = tty_alloc_driver(1, |
187 | TTY_DRIVER_RESET_TERMIOS | | ||
188 | TTY_DRIVER_REAL_RAW | | ||
189 | TTY_DRIVER_UNNUMBERED_NODE); | ||
188 | if (!ttyprintk_driver) | 190 | if (!ttyprintk_driver) |
189 | return ret; | 191 | return ret; |
190 | 192 | ||
@@ -195,8 +197,6 @@ static int __init ttyprintk_init(void) | |||
195 | ttyprintk_driver->type = TTY_DRIVER_TYPE_CONSOLE; | 197 | ttyprintk_driver->type = TTY_DRIVER_TYPE_CONSOLE; |
196 | ttyprintk_driver->init_termios = tty_std_termios; | 198 | ttyprintk_driver->init_termios = tty_std_termios; |
197 | ttyprintk_driver->init_termios.c_oflag = OPOST | OCRNL | ONOCR | ONLRET; | 199 | ttyprintk_driver->init_termios.c_oflag = OPOST | OCRNL | ONOCR | ONLRET; |
198 | ttyprintk_driver->flags = TTY_DRIVER_RESET_TERMIOS | | ||
199 | TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; | ||
200 | tty_set_operations(ttyprintk_driver, &ttyprintk_ops); | 200 | tty_set_operations(ttyprintk_driver, &ttyprintk_ops); |
201 | 201 | ||
202 | ret = tty_register_driver(ttyprintk_driver); | 202 | ret = tty_register_driver(ttyprintk_driver); |
@@ -205,15 +205,6 @@ static int __init ttyprintk_init(void) | |||
205 | goto error; | 205 | goto error; |
206 | } | 206 | } |
207 | 207 | ||
208 | /* create our unnumbered device */ | ||
209 | rp = device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 3), NULL, | ||
210 | ttyprintk_driver->name); | ||
211 | if (IS_ERR(rp)) { | ||
212 | printk(KERN_ERR "Couldn't create ttyprintk device\n"); | ||
213 | ret = PTR_ERR(rp); | ||
214 | goto error; | ||
215 | } | ||
216 | |||
217 | return 0; | 208 | return 0; |
218 | 209 | ||
219 | error: | 210 | error: |