@@ -160,7 +160,6 @@ static int info_idx = -1;
160
160
161
161
/* console rotation */
162
162
static int initial_rotation = -1 ;
163
- static int fbcon_has_sysfs ;
164
163
static int margin_color ;
165
164
166
165
static const struct consw fb_con ;
@@ -3159,7 +3158,7 @@ static const struct consw fb_con = {
3159
3158
.con_debug_leave = fbcon_debug_leave ,
3160
3159
};
3161
3160
3162
- static ssize_t store_rotate (struct device * device ,
3161
+ static ssize_t rotate_store (struct device * device ,
3163
3162
struct device_attribute * attr , const char * buf ,
3164
3163
size_t count )
3165
3164
{
@@ -3181,7 +3180,7 @@ static ssize_t store_rotate(struct device *device,
3181
3180
return count ;
3182
3181
}
3183
3182
3184
- static ssize_t store_rotate_all (struct device * device ,
3183
+ static ssize_t rotate_all_store (struct device * device ,
3185
3184
struct device_attribute * attr ,const char * buf ,
3186
3185
size_t count )
3187
3186
{
@@ -3203,7 +3202,7 @@ static ssize_t store_rotate_all(struct device *device,
3203
3202
return count ;
3204
3203
}
3205
3204
3206
- static ssize_t show_rotate (struct device * device ,
3205
+ static ssize_t rotate_show (struct device * device ,
3207
3206
struct device_attribute * attr ,char * buf )
3208
3207
{
3209
3208
struct fb_info * info ;
@@ -3222,7 +3221,7 @@ static ssize_t show_rotate(struct device *device,
3222
3221
return sysfs_emit (buf , "%d\n" , rotate );
3223
3222
}
3224
3223
3225
- static ssize_t show_cursor_blink (struct device * device ,
3224
+ static ssize_t cursor_blink_show (struct device * device ,
3226
3225
struct device_attribute * attr , char * buf )
3227
3226
{
3228
3227
struct fb_info * info ;
@@ -3247,7 +3246,7 @@ static ssize_t show_cursor_blink(struct device *device,
3247
3246
return sysfs_emit (buf , "%d\n" , blink );
3248
3247
}
3249
3248
3250
- static ssize_t store_cursor_blink (struct device * device ,
3249
+ static ssize_t cursor_blink_store (struct device * device ,
3251
3250
struct device_attribute * attr ,
3252
3251
const char * buf , size_t count )
3253
3252
{
@@ -3281,35 +3280,18 @@ static ssize_t store_cursor_blink(struct device *device,
3281
3280
return count ;
3282
3281
}
3283
3282
3284
- static struct device_attribute device_attrs [] = {
3285
- __ATTR (rotate , S_IRUGO |S_IWUSR , show_rotate , store_rotate ),
3286
- __ATTR (rotate_all , S_IWUSR , NULL , store_rotate_all ),
3287
- __ATTR (cursor_blink , S_IRUGO |S_IWUSR , show_cursor_blink ,
3288
- store_cursor_blink ),
3289
- };
3290
-
3291
- static int fbcon_init_device (void )
3292
- {
3293
- int i , error = 0 ;
3283
+ static DEVICE_ATTR_RW (cursor_blink );
3284
+ static DEVICE_ATTR_RW (rotate );
3285
+ static DEVICE_ATTR_WO (rotate_all );
3294
3286
3295
- fbcon_has_sysfs = 1 ;
3296
-
3297
- for (i = 0 ; i < ARRAY_SIZE (device_attrs ); i ++ ) {
3298
- error = device_create_file (fbcon_device , & device_attrs [i ]);
3299
-
3300
- if (error )
3301
- break ;
3302
- }
3303
-
3304
- if (error ) {
3305
- while (-- i >= 0 )
3306
- device_remove_file (fbcon_device , & device_attrs [i ]);
3307
-
3308
- fbcon_has_sysfs = 0 ;
3309
- }
3287
+ static struct attribute * fbcon_device_attrs [] = {
3288
+ & dev_attr_cursor_blink .attr ,
3289
+ & dev_attr_rotate .attr ,
3290
+ & dev_attr_rotate_all .attr ,
3291
+ NULL
3292
+ };
3310
3293
3311
- return 0 ;
3312
- }
3294
+ ATTRIBUTE_GROUPS (fbcon_device );
3313
3295
3314
3296
#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER
3315
3297
static void fbcon_register_existing_fbs (struct work_struct * work )
@@ -3367,16 +3349,16 @@ void __init fb_console_init(void)
3367
3349
int i ;
3368
3350
3369
3351
console_lock ();
3370
- fbcon_device = device_create (fb_class , NULL , MKDEV (0 , 0 ), NULL ,
3371
- "fbcon" );
3352
+ fbcon_device = device_create_with_groups (fb_class , NULL ,
3353
+ MKDEV (0 , 0 ), NULL ,
3354
+ fbcon_device_groups , "fbcon" );
3372
3355
3373
3356
if (IS_ERR (fbcon_device )) {
3374
3357
printk (KERN_WARNING "Unable to create device "
3375
3358
"for fbcon; errno = %ld\n" ,
3376
3359
PTR_ERR (fbcon_device ));
3377
3360
fbcon_device = NULL ;
3378
- } else
3379
- fbcon_init_device ();
3361
+ }
3380
3362
3381
3363
for (i = 0 ; i < MAX_NR_CONSOLES ; i ++ )
3382
3364
con2fb_map [i ] = -1 ;
@@ -3387,18 +3369,6 @@ void __init fb_console_init(void)
3387
3369
3388
3370
#ifdef MODULE
3389
3371
3390
- static void __exit fbcon_deinit_device (void )
3391
- {
3392
- int i ;
3393
-
3394
- if (fbcon_has_sysfs ) {
3395
- for (i = 0 ; i < ARRAY_SIZE (device_attrs ); i ++ )
3396
- device_remove_file (fbcon_device , & device_attrs [i ]);
3397
-
3398
- fbcon_has_sysfs = 0 ;
3399
- }
3400
- }
3401
-
3402
3372
void __exit fb_console_exit (void )
3403
3373
{
3404
3374
#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER
@@ -3411,7 +3381,6 @@ void __exit fb_console_exit(void)
3411
3381
#endif
3412
3382
3413
3383
console_lock ();
3414
- fbcon_deinit_device ();
3415
3384
device_destroy (fb_class , MKDEV (0 , 0 ));
3416
3385
3417
3386
do_unregister_con_driver (& fb_con );
0 commit comments