diff options
author | Alan Cox <alan@redhat.com> | 2008-10-13 05:41:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 12:51:42 -0400 |
commit | d81ed10307027e1643a65ab5fe17cc01233d376d (patch) | |
tree | e46ac5735124308357f42214a8a26f75dcd3f412 /drivers/char/vt.c | |
parent | feebed6515a113eeb33919e9557a8b9710ea627c (diff) |
tty: Remove more special casing and out of place code
Carry on pushing code out of tty_io when it belongs to other drivers. I'm
not 100% happy with some of this and it will be worth revisiting some of the
exports later when the restructuring work is done.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/vt.c')
-rw-r--r-- | drivers/char/vt.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 37a45db5bae0..57029fefd64a 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -100,10 +100,10 @@ | |||
100 | #include <linux/font.h> | 100 | #include <linux/font.h> |
101 | #include <linux/bitops.h> | 101 | #include <linux/bitops.h> |
102 | #include <linux/notifier.h> | 102 | #include <linux/notifier.h> |
103 | 103 | #include <linux/device.h> | |
104 | #include <asm/io.h> | 104 | #include <linux/io.h> |
105 | #include <asm/system.h> | 105 | #include <asm/system.h> |
106 | #include <asm/uaccess.h> | 106 | #include <linux/uaccess.h> |
107 | 107 | ||
108 | #define MAX_NR_CON_DRIVER 16 | 108 | #define MAX_NR_CON_DRIVER 16 |
109 | 109 | ||
@@ -2352,8 +2352,6 @@ rescan_last_byte: | |||
2352 | FLUSH | 2352 | FLUSH |
2353 | console_conditional_schedule(); | 2353 | console_conditional_schedule(); |
2354 | release_console_sem(); | 2354 | release_console_sem(); |
2355 | |||
2356 | out: | ||
2357 | notify_update(vc); | 2355 | notify_update(vc); |
2358 | return n; | 2356 | return n; |
2359 | #undef FLUSH | 2357 | #undef FLUSH |
@@ -2784,13 +2782,6 @@ static int con_open(struct tty_struct *tty, struct file *filp) | |||
2784 | return ret; | 2782 | return ret; |
2785 | } | 2783 | } |
2786 | 2784 | ||
2787 | /* | ||
2788 | * We take tty_mutex in here to prevent another thread from coming in via init_dev | ||
2789 | * and taking a ref against the tty while we're in the process of forgetting | ||
2790 | * about it and cleaning things up. | ||
2791 | * | ||
2792 | * This is because vcs_remove_sysfs() can sleep and will drop the BKL. | ||
2793 | */ | ||
2794 | static void con_close(struct tty_struct *tty, struct file *filp) | 2785 | static void con_close(struct tty_struct *tty, struct file *filp) |
2795 | { | 2786 | { |
2796 | /* Nothing to do - we defer to shutdown */ | 2787 | /* Nothing to do - we defer to shutdown */ |
@@ -2932,8 +2923,16 @@ static const struct tty_operations con_ops = { | |||
2932 | .shutdown = con_shutdown | 2923 | .shutdown = con_shutdown |
2933 | }; | 2924 | }; |
2934 | 2925 | ||
2935 | int __init vty_init(void) | 2926 | static struct cdev vc0_cdev; |
2927 | |||
2928 | int __init vty_init(const struct file_operations *console_fops) | ||
2936 | { | 2929 | { |
2930 | cdev_init(&vc0_cdev, console_fops); | ||
2931 | if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) || | ||
2932 | register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0) | ||
2933 | panic("Couldn't register /dev/tty0 driver\n"); | ||
2934 | device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0"); | ||
2935 | |||
2937 | vcs_init(); | 2936 | vcs_init(); |
2938 | 2937 | ||
2939 | console_driver = alloc_tty_driver(MAX_NR_CONSOLES); | 2938 | console_driver = alloc_tty_driver(MAX_NR_CONSOLES); |
@@ -2952,7 +2951,6 @@ int __init vty_init(void) | |||
2952 | tty_set_operations(console_driver, &con_ops); | 2951 | tty_set_operations(console_driver, &con_ops); |
2953 | if (tty_register_driver(console_driver)) | 2952 | if (tty_register_driver(console_driver)) |
2954 | panic("Couldn't register console driver\n"); | 2953 | panic("Couldn't register console driver\n"); |
2955 | |||
2956 | kbd_init(); | 2954 | kbd_init(); |
2957 | console_map_init(); | 2955 | console_map_init(); |
2958 | #ifdef CONFIG_PROM_CONSOLE | 2956 | #ifdef CONFIG_PROM_CONSOLE |
@@ -3446,7 +3444,7 @@ int register_con_driver(const struct consw *csw, int first, int last) | |||
3446 | if (retval) | 3444 | if (retval) |
3447 | goto err; | 3445 | goto err; |
3448 | 3446 | ||
3449 | con_driver->dev = device_create_drvdata(vtconsole_class, NULL, | 3447 | con_driver->dev = device_create(vtconsole_class, NULL, |
3450 | MKDEV(0, con_driver->node), | 3448 | MKDEV(0, con_driver->node), |
3451 | NULL, "vtcon%i", | 3449 | NULL, "vtcon%i", |
3452 | con_driver->node); | 3450 | con_driver->node); |
@@ -3557,7 +3555,7 @@ static int __init vtconsole_class_init(void) | |||
3557 | struct con_driver *con = ®istered_con_driver[i]; | 3555 | struct con_driver *con = ®istered_con_driver[i]; |
3558 | 3556 | ||
3559 | if (con->con && !con->dev) { | 3557 | if (con->con && !con->dev) { |
3560 | con->dev = device_create_drvdata(vtconsole_class, NULL, | 3558 | con->dev = device_create(vtconsole_class, NULL, |
3561 | MKDEV(0, con->node), | 3559 | MKDEV(0, con->node), |
3562 | NULL, "vtcon%i", | 3560 | NULL, "vtcon%i", |
3563 | con->node); | 3561 | con->node); |