/* console rotation */
static int rotate;
+static int fbcon_has_sysfs;
static const struct consw fb_con;
static int fbcon_init_class_device(void)
{
- int i;
+ int i, error = 0;
+
+ fbcon_has_sysfs = 1;
+
+ for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) {
+ error = class_device_create_file(fbcon_class_device,
+ &class_device_attrs[i]);
+
+ if (error)
+ break;
+ }
+
+ if (error) {
+ while (--i >= 0)
+ class_device_remove_file(fbcon_class_device,
+ &class_device_attrs[i]);
+
+ fbcon_has_sysfs = 0;
+ }
- for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
- class_device_create_file(fbcon_class_device,
- &class_device_attrs[i]);
return 0;
}
{
int i;
- for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
- class_device_remove_file(fbcon_class_device,
- &class_device_attrs[i]);
+ if (fbcon_has_sysfs) {
+ for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
+ class_device_remove_file(fbcon_class_device,
+ &class_device_attrs[i]);
+
+ fbcon_has_sysfs = 0;
+ }
}
static void __exit fb_console_exit(void)