aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/vt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/vt.c')
-rw-r--r--drivers/char/vt.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index ec0c070bf15f..8e4413f6fbaf 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -106,7 +106,8 @@
106#define MAX_NR_CON_DRIVER 16 106#define MAX_NR_CON_DRIVER 16
107 107
108#define CON_DRIVER_FLAG_MODULE 1 108#define CON_DRIVER_FLAG_MODULE 1
109#define CON_DRIVER_FLAG_INIT 2 109#define CON_DRIVER_FLAG_INIT 2
110#define CON_DRIVER_FLAG_ATTR 4
110 111
111struct con_driver { 112struct con_driver {
112 const struct consw *con; 113 const struct consw *con;
@@ -138,14 +139,6 @@ const struct consw *conswitchp;
138extern void vcs_make_sysfs(struct tty_struct *tty); 139extern void vcs_make_sysfs(struct tty_struct *tty);
139extern void vcs_remove_sysfs(struct tty_struct *tty); 140extern void vcs_remove_sysfs(struct tty_struct *tty);
140 141
141extern void console_map_init(void);
142#ifdef CONFIG_PROM_CONSOLE
143extern void prom_con_init(void);
144#endif
145#ifdef CONFIG_MDA_CONSOLE
146extern int mda_console_init(void);
147#endif
148
149struct vc vc_cons [MAX_NR_CONSOLES]; 142struct vc vc_cons [MAX_NR_CONSOLES];
150 143
151#ifndef VT_SINGLE_DRIVER 144#ifndef VT_SINGLE_DRIVER
@@ -3070,22 +3063,37 @@ static struct class_device_attribute class_device_attrs[] = {
3070static int vtconsole_init_class_device(struct con_driver *con) 3063static int vtconsole_init_class_device(struct con_driver *con)
3071{ 3064{
3072 int i; 3065 int i;
3066 int error = 0;
3073 3067
3068 con->flag |= CON_DRIVER_FLAG_ATTR;
3074 class_set_devdata(con->class_dev, con); 3069 class_set_devdata(con->class_dev, con);
3075 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) 3070 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) {
3076 class_device_create_file(con->class_dev, 3071 error = class_device_create_file(con->class_dev,
3072 &class_device_attrs[i]);
3073 if (error)
3074 break;
3075 }
3076
3077 if (error) {
3078 while (--i >= 0)
3079 class_device_remove_file(con->class_dev,
3077 &class_device_attrs[i]); 3080 &class_device_attrs[i]);
3081 con->flag &= ~CON_DRIVER_FLAG_ATTR;
3082 }
3078 3083
3079 return 0; 3084 return error;
3080} 3085}
3081 3086
3082static void vtconsole_deinit_class_device(struct con_driver *con) 3087static void vtconsole_deinit_class_device(struct con_driver *con)
3083{ 3088{
3084 int i; 3089 int i;
3085 3090
3086 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) 3091 if (con->flag & CON_DRIVER_FLAG_ATTR) {
3087 class_device_remove_file(con->class_dev, 3092 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
3088 &class_device_attrs[i]); 3093 class_device_remove_file(con->class_dev,
3094 &class_device_attrs[i]);
3095 con->flag &= ~CON_DRIVER_FLAG_ATTR;
3096 }
3089} 3097}
3090 3098
3091/** 3099/**
@@ -3184,6 +3192,7 @@ int register_con_driver(const struct consw *csw, int first, int last)
3184 } else { 3192 } else {
3185 vtconsole_init_class_device(con_driver); 3193 vtconsole_init_class_device(con_driver);
3186 } 3194 }
3195
3187err: 3196err:
3188 release_console_sem(); 3197 release_console_sem();
3189 module_put(owner); 3198 module_put(owner);