diff options
-rw-r--r-- | drivers/video/console/fbcon.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 9e3ff00e4c14..8c041daa3a15 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
@@ -133,6 +133,7 @@ static int info_idx = -1; | |||
133 | 133 | ||
134 | /* console rotation */ | 134 | /* console rotation */ |
135 | static int rotate; | 135 | static int rotate; |
136 | static int fbcon_has_sysfs; | ||
136 | 137 | ||
137 | static const struct consw fb_con; | 138 | static const struct consw fb_con; |
138 | 139 | ||
@@ -3166,11 +3167,26 @@ static struct class_device_attribute class_device_attrs[] = { | |||
3166 | 3167 | ||
3167 | static int fbcon_init_class_device(void) | 3168 | static int fbcon_init_class_device(void) |
3168 | { | 3169 | { |
3169 | int i; | 3170 | int i, error = 0; |
3171 | |||
3172 | fbcon_has_sysfs = 1; | ||
3173 | |||
3174 | for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) { | ||
3175 | error = class_device_create_file(fbcon_class_device, | ||
3176 | &class_device_attrs[i]); | ||
3177 | |||
3178 | if (error) | ||
3179 | break; | ||
3180 | } | ||
3181 | |||
3182 | if (error) { | ||
3183 | while (--i >= 0) | ||
3184 | class_device_remove_file(fbcon_class_device, | ||
3185 | &class_device_attrs[i]); | ||
3186 | |||
3187 | fbcon_has_sysfs = 0; | ||
3188 | } | ||
3170 | 3189 | ||
3171 | for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) | ||
3172 | class_device_create_file(fbcon_class_device, | ||
3173 | &class_device_attrs[i]); | ||
3174 | return 0; | 3190 | return 0; |
3175 | } | 3191 | } |
3176 | 3192 | ||
@@ -3279,9 +3295,13 @@ static void __exit fbcon_deinit_class_device(void) | |||
3279 | { | 3295 | { |
3280 | int i; | 3296 | int i; |
3281 | 3297 | ||
3282 | for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) | 3298 | if (fbcon_has_sysfs) { |
3283 | class_device_remove_file(fbcon_class_device, | 3299 | for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) |
3284 | &class_device_attrs[i]); | 3300 | class_device_remove_file(fbcon_class_device, |
3301 | &class_device_attrs[i]); | ||
3302 | |||
3303 | fbcon_has_sysfs = 0; | ||
3304 | } | ||
3285 | } | 3305 | } |
3286 | 3306 | ||
3287 | static void __exit fb_console_exit(void) | 3307 | static void __exit fb_console_exit(void) |