aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntonino A. Daplas <adaplas@gmail.com>2007-07-17 07:05:26 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-17 13:23:11 -0400
commit0c6c1ce079082ddde9ba5636c352c235cd395aa1 (patch)
tree3af2bf5a5083a675937f23f3320de33680d2452b
parentacba9cd01974353294ecd0c750581a6707d1ebe1 (diff)
fbcon: use struct device instead of struct class_device
Port fbcon.c to use struct device from using struct class_device Signed-off-by: Antonino Daplas <adaplas@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/video/console/fbcon.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index b7e143efa81d..7f4ed792307c 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -198,7 +198,7 @@ static void fbcon_modechanged(struct fb_info *info);
198static void fbcon_set_all_vcs(struct fb_info *info); 198static void fbcon_set_all_vcs(struct fb_info *info);
199static void fbcon_start(void); 199static void fbcon_start(void);
200static void fbcon_exit(void); 200static void fbcon_exit(void);
201static struct class_device *fbcon_class_device; 201static struct device *fbcon_device;
202 202
203#ifdef CONFIG_MAC 203#ifdef CONFIG_MAC
204/* 204/*
@@ -3246,8 +3246,9 @@ static struct notifier_block fbcon_event_notifier = {
3246 .notifier_call = fbcon_event_notify, 3246 .notifier_call = fbcon_event_notify,
3247}; 3247};
3248 3248
3249static ssize_t store_rotate(struct class_device *class_device, 3249static ssize_t store_rotate(struct device *device,
3250 const char *buf, size_t count) 3250 struct device_attribute *attr, const char *buf,
3251 size_t count)
3251{ 3252{
3252 struct fb_info *info; 3253 struct fb_info *info;
3253 int rotate, idx; 3254 int rotate, idx;
@@ -3270,8 +3271,9 @@ err:
3270 return count; 3271 return count;
3271} 3272}
3272 3273
3273static ssize_t store_rotate_all(struct class_device *class_device, 3274static ssize_t store_rotate_all(struct device *device,
3274 const char *buf, size_t count) 3275 struct device_attribute *attr,const char *buf,
3276 size_t count)
3275{ 3277{
3276 struct fb_info *info; 3278 struct fb_info *info;
3277 int rotate, idx; 3279 int rotate, idx;
@@ -3294,7 +3296,8 @@ err:
3294 return count; 3296 return count;
3295} 3297}
3296 3298
3297static ssize_t show_rotate(struct class_device *class_device, char *buf) 3299static ssize_t show_rotate(struct device *device,
3300 struct device_attribute *attr,char *buf)
3298{ 3301{
3299 struct fb_info *info; 3302 struct fb_info *info;
3300 int rotate = 0, idx; 3303 int rotate = 0, idx;
@@ -3315,7 +3318,8 @@ err:
3315 return snprintf(buf, PAGE_SIZE, "%d\n", rotate); 3318 return snprintf(buf, PAGE_SIZE, "%d\n", rotate);
3316} 3319}
3317 3320
3318static ssize_t show_cursor_blink(struct class_device *class_device, char *buf) 3321static ssize_t show_cursor_blink(struct device *device,
3322 struct device_attribute *attr, char *buf)
3319{ 3323{
3320 struct fb_info *info; 3324 struct fb_info *info;
3321 struct fbcon_ops *ops; 3325 struct fbcon_ops *ops;
@@ -3342,7 +3346,8 @@ err:
3342 return snprintf(buf, PAGE_SIZE, "%d\n", blink); 3346 return snprintf(buf, PAGE_SIZE, "%d\n", blink);
3343} 3347}
3344 3348
3345static ssize_t store_cursor_blink(struct class_device *clas_device, 3349static ssize_t store_cursor_blink(struct device *device,
3350 struct device_attribute *attr,
3346 const char *buf, size_t count) 3351 const char *buf, size_t count)
3347{ 3352{
3348 struct fb_info *info; 3353 struct fb_info *info;
@@ -3378,22 +3383,21 @@ err:
3378 return count; 3383 return count;
3379} 3384}
3380 3385
3381static struct class_device_attribute class_device_attrs[] = { 3386static struct device_attribute device_attrs[] = {
3382 __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate), 3387 __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate),
3383 __ATTR(rotate_all, S_IWUSR, NULL, store_rotate_all), 3388 __ATTR(rotate_all, S_IWUSR, NULL, store_rotate_all),
3384 __ATTR(cursor_blink, S_IRUGO|S_IWUSR, show_cursor_blink, 3389 __ATTR(cursor_blink, S_IRUGO|S_IWUSR, show_cursor_blink,
3385 store_cursor_blink), 3390 store_cursor_blink),
3386}; 3391};
3387 3392
3388static int fbcon_init_class_device(void) 3393static int fbcon_init_device(void)
3389{ 3394{
3390 int i, error = 0; 3395 int i, error = 0;
3391 3396
3392 fbcon_has_sysfs = 1; 3397 fbcon_has_sysfs = 1;
3393 3398
3394 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) { 3399 for (i = 0; i < ARRAY_SIZE(device_attrs); i++) {
3395 error = class_device_create_file(fbcon_class_device, 3400 error = device_create_file(fbcon_device, &device_attrs[i]);
3396 &class_device_attrs[i]);
3397 3401
3398 if (error) 3402 if (error)
3399 break; 3403 break;
@@ -3401,8 +3405,7 @@ static int fbcon_init_class_device(void)
3401 3405
3402 if (error) { 3406 if (error) {
3403 while (--i >= 0) 3407 while (--i >= 0)
3404 class_device_remove_file(fbcon_class_device, 3408 device_remove_file(fbcon_device, &device_attrs[i]);
3405 &class_device_attrs[i]);
3406 3409
3407 fbcon_has_sysfs = 0; 3410 fbcon_has_sysfs = 0;
3408 } 3411 }
@@ -3488,16 +3491,15 @@ static int __init fb_console_init(void)
3488 3491
3489 acquire_console_sem(); 3492 acquire_console_sem();
3490 fb_register_client(&fbcon_event_notifier); 3493 fb_register_client(&fbcon_event_notifier);
3491 fbcon_class_device = 3494 fbcon_device = device_create(fb_class, NULL, MKDEV(0, 0), "fbcon");
3492 class_device_create(fb_class, NULL, MKDEV(0, 0), NULL, "fbcon");
3493 3495
3494 if (IS_ERR(fbcon_class_device)) { 3496 if (IS_ERR(fbcon_device)) {
3495 printk(KERN_WARNING "Unable to create class_device " 3497 printk(KERN_WARNING "Unable to create device "
3496 "for fbcon; errno = %ld\n", 3498 "for fbcon; errno = %ld\n",
3497 PTR_ERR(fbcon_class_device)); 3499 PTR_ERR(fbcon_device));
3498 fbcon_class_device = NULL; 3500 fbcon_device = NULL;
3499 } else 3501 } else
3500 fbcon_init_class_device(); 3502 fbcon_init_device();
3501 3503
3502 for (i = 0; i < MAX_NR_CONSOLES; i++) 3504 for (i = 0; i < MAX_NR_CONSOLES; i++)
3503 con2fb_map[i] = -1; 3505 con2fb_map[i] = -1;
@@ -3511,14 +3513,13 @@ module_init(fb_console_init);
3511 3513
3512#ifdef MODULE 3514#ifdef MODULE
3513 3515
3514static void __exit fbcon_deinit_class_device(void) 3516static void __exit fbcon_deinit_device(void)
3515{ 3517{
3516 int i; 3518 int i;
3517 3519
3518 if (fbcon_has_sysfs) { 3520 if (fbcon_has_sysfs) {
3519 for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) 3521 for (i = 0; i < ARRAY_SIZE(device_attrs); i++)
3520 class_device_remove_file(fbcon_class_device, 3522 device_remove_file(fbcon_device, &device_attrs[i]);
3521 &class_device_attrs[i]);
3522 3523
3523 fbcon_has_sysfs = 0; 3524 fbcon_has_sysfs = 0;
3524 } 3525 }
@@ -3528,8 +3529,8 @@ static void __exit fb_console_exit(void)
3528{ 3529{
3529 acquire_console_sem(); 3530 acquire_console_sem();
3530 fb_unregister_client(&fbcon_event_notifier); 3531 fb_unregister_client(&fbcon_event_notifier);
3531 fbcon_deinit_class_device(); 3532 fbcon_deinit_device();
3532 class_device_destroy(fb_class, MKDEV(0, 0)); 3533 device_destroy(fb_class, MKDEV(0, 0));
3533 fbcon_exit(); 3534 fbcon_exit();
3534 release_console_sem(); 3535 release_console_sem();
3535 unregister_con_driver(&fb_con); 3536 unregister_con_driver(&fb_con);