diff options
author | Antonino A. Daplas <adaplas@gmail.com> | 2006-06-26 03:26:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 12:58:29 -0400 |
commit | 20cecf6a6ade62e3a721eb31540f22126df7462b (patch) | |
tree | 064382401cbee14ca35b48ebdf34047fab7f2824 | |
parent | 103edf024b98ff6a1feef9c43886f39b00c5753d (diff) |
[PATCH] vfb: Update platform code
Update platform code to dynamically allocate the platform device
Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/video/vfb.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/drivers/video/vfb.c b/drivers/video/vfb.c index 77eed1fd9943..d073ffb6e1f9 100644 --- a/drivers/video/vfb.c +++ b/drivers/video/vfb.c | |||
@@ -398,12 +398,6 @@ static int __init vfb_setup(char *options) | |||
398 | * Initialisation | 398 | * Initialisation |
399 | */ | 399 | */ |
400 | 400 | ||
401 | static void vfb_platform_release(struct device *device) | ||
402 | { | ||
403 | // This is called when the reference count goes to zero. | ||
404 | dev_err(device, "This driver is broken, please bug the authors so they will fix it.\n"); | ||
405 | } | ||
406 | |||
407 | static int __init vfb_probe(struct platform_device *dev) | 401 | static int __init vfb_probe(struct platform_device *dev) |
408 | { | 402 | { |
409 | struct fb_info *info; | 403 | struct fb_info *info; |
@@ -482,13 +476,7 @@ static struct platform_driver vfb_driver = { | |||
482 | }, | 476 | }, |
483 | }; | 477 | }; |
484 | 478 | ||
485 | static struct platform_device vfb_device = { | 479 | static struct platform_device *vfb_device; |
486 | .name = "vfb", | ||
487 | .id = 0, | ||
488 | .dev = { | ||
489 | .release = vfb_platform_release, | ||
490 | } | ||
491 | }; | ||
492 | 480 | ||
493 | static int __init vfb_init(void) | 481 | static int __init vfb_init(void) |
494 | { | 482 | { |
@@ -508,10 +496,19 @@ static int __init vfb_init(void) | |||
508 | ret = platform_driver_register(&vfb_driver); | 496 | ret = platform_driver_register(&vfb_driver); |
509 | 497 | ||
510 | if (!ret) { | 498 | if (!ret) { |
511 | ret = platform_device_register(&vfb_device); | 499 | vfb_device = platform_device_alloc("vfb", 0); |
512 | if (ret) | 500 | |
501 | if (vfb_device) | ||
502 | ret = platform_device_add(vfb_device); | ||
503 | else | ||
504 | ret = -ENOMEM; | ||
505 | |||
506 | if (ret) { | ||
507 | platform_device_put(vfb_device); | ||
513 | platform_driver_unregister(&vfb_driver); | 508 | platform_driver_unregister(&vfb_driver); |
509 | } | ||
514 | } | 510 | } |
511 | |||
515 | return ret; | 512 | return ret; |
516 | } | 513 | } |
517 | 514 | ||
@@ -520,7 +517,7 @@ module_init(vfb_init); | |||
520 | #ifdef MODULE | 517 | #ifdef MODULE |
521 | static void __exit vfb_exit(void) | 518 | static void __exit vfb_exit(void) |
522 | { | 519 | { |
523 | platform_device_unregister(&vfb_device); | 520 | platform_device_unregister(vfb_device); |
524 | platform_driver_unregister(&vfb_driver); | 521 | platform_driver_unregister(&vfb_driver); |
525 | } | 522 | } |
526 | 523 | ||