diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
commit | 3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch) | |
tree | d8825be54cefb6ad6707478d719c8e30605bee7b /drivers/video/imxfb.c | |
parent | 00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (diff) |
[DRIVER MODEL] Convert platform drivers to use struct platform_driver
This allows us to eliminate the casts in the drivers, and eventually
remove the use of the device_driver function pointer methods for
platform device drivers.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/video/imxfb.c')
-rw-r--r-- | drivers/video/imxfb.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index e20b9f3a255f..5924cc225c95 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c | |||
@@ -423,18 +423,18 @@ static void imxfb_setup_gpio(struct imxfb_info *fbi) | |||
423 | * Power management hooks. Note that we won't be called from IRQ context, | 423 | * Power management hooks. Note that we won't be called from IRQ context, |
424 | * unlike the blank functions above, so we may sleep. | 424 | * unlike the blank functions above, so we may sleep. |
425 | */ | 425 | */ |
426 | static int imxfb_suspend(struct device *dev, pm_message_t state) | 426 | static int imxfb_suspend(struct platform_device *dev, pm_message_t state) |
427 | { | 427 | { |
428 | struct imxfb_info *fbi = dev_get_drvdata(dev); | 428 | struct imxfb_info *fbi = platform_get_drvdata(dev); |
429 | pr_debug("%s\n",__FUNCTION__); | 429 | pr_debug("%s\n",__FUNCTION__); |
430 | 430 | ||
431 | imxfb_disable_controller(fbi); | 431 | imxfb_disable_controller(fbi); |
432 | return 0; | 432 | return 0; |
433 | } | 433 | } |
434 | 434 | ||
435 | static int imxfb_resume(struct device *dev) | 435 | static int imxfb_resume(struct platform_device *dev) |
436 | { | 436 | { |
437 | struct imxfb_info *fbi = dev_get_drvdata(dev); | 437 | struct imxfb_info *fbi = platform_get_drvdata(dev); |
438 | pr_debug("%s\n",__FUNCTION__); | 438 | pr_debug("%s\n",__FUNCTION__); |
439 | 439 | ||
440 | imxfb_enable_controller(fbi); | 440 | imxfb_enable_controller(fbi); |
@@ -538,9 +538,8 @@ static int __init imxfb_map_video_memory(struct fb_info *info) | |||
538 | return fbi->map_cpu ? 0 : -ENOMEM; | 538 | return fbi->map_cpu ? 0 : -ENOMEM; |
539 | } | 539 | } |
540 | 540 | ||
541 | static int __init imxfb_probe(struct device *dev) | 541 | static int __init imxfb_probe(struct platform_device *pdev) |
542 | { | 542 | { |
543 | struct platform_device *pdev = to_platform_device(dev); | ||
544 | struct imxfb_info *fbi; | 543 | struct imxfb_info *fbi; |
545 | struct fb_info *info; | 544 | struct fb_info *info; |
546 | struct imxfb_mach_info *inf; | 545 | struct imxfb_mach_info *inf; |
@@ -553,21 +552,21 @@ static int __init imxfb_probe(struct device *dev) | |||
553 | if(!res) | 552 | if(!res) |
554 | return -ENODEV; | 553 | return -ENODEV; |
555 | 554 | ||
556 | inf = dev->platform_data; | 555 | inf = pdev->dev.platform_data; |
557 | if(!inf) { | 556 | if(!inf) { |
558 | dev_err(dev,"No platform_data available\n"); | 557 | dev_err(dev,"No platform_data available\n"); |
559 | return -ENOMEM; | 558 | return -ENOMEM; |
560 | } | 559 | } |
561 | 560 | ||
562 | info = framebuffer_alloc(sizeof(struct imxfb_info), dev); | 561 | info = framebuffer_alloc(sizeof(struct imxfb_info), &pdev->dev); |
563 | if(!info) | 562 | if(!info) |
564 | return -ENOMEM; | 563 | return -ENOMEM; |
565 | 564 | ||
566 | fbi = info->par; | 565 | fbi = info->par; |
567 | 566 | ||
568 | dev_set_drvdata(dev, info); | 567 | platform_set_drvdata(pdev, info); |
569 | 568 | ||
570 | ret = imxfb_init_fbinfo(dev); | 569 | ret = imxfb_init_fbinfo(&pdev->dev); |
571 | if( ret < 0 ) | 570 | if( ret < 0 ) |
572 | goto failed_init; | 571 | goto failed_init; |
573 | 572 | ||
@@ -621,22 +620,21 @@ failed_register: | |||
621 | fb_dealloc_cmap(&info->cmap); | 620 | fb_dealloc_cmap(&info->cmap); |
622 | failed_cmap: | 621 | failed_cmap: |
623 | if (!inf->fixed_screen_cpu) | 622 | if (!inf->fixed_screen_cpu) |
624 | dma_free_writecombine(dev,fbi->map_size,fbi->map_cpu, | 623 | dma_free_writecombine(&pdev->dev,fbi->map_size,fbi->map_cpu, |
625 | fbi->map_dma); | 624 | fbi->map_dma); |
626 | failed_map: | 625 | failed_map: |
627 | kfree(info->pseudo_palette); | 626 | kfree(info->pseudo_palette); |
628 | failed_regs: | 627 | failed_regs: |
629 | release_mem_region(res->start, res->end - res->start); | 628 | release_mem_region(res->start, res->end - res->start); |
630 | failed_init: | 629 | failed_init: |
631 | dev_set_drvdata(dev, NULL); | 630 | platform_set_drvdata(pdev, NULL); |
632 | framebuffer_release(info); | 631 | framebuffer_release(info); |
633 | return ret; | 632 | return ret; |
634 | } | 633 | } |
635 | 634 | ||
636 | static int imxfb_remove(struct device *dev) | 635 | static int imxfb_remove(struct platform_device *pdev) |
637 | { | 636 | { |
638 | struct platform_device *pdev = to_platform_device(dev); | 637 | struct fb_info *info = platform_get_drvdata(pdev); |
639 | struct fb_info *info = dev_get_drvdata(dev); | ||
640 | struct imxfb_info *fbi = info->par; | 638 | struct imxfb_info *fbi = info->par; |
641 | struct resource *res; | 639 | struct resource *res; |
642 | 640 | ||
@@ -651,36 +649,37 @@ static int imxfb_remove(struct device *dev) | |||
651 | framebuffer_release(info); | 649 | framebuffer_release(info); |
652 | 650 | ||
653 | release_mem_region(res->start, res->end - res->start + 1); | 651 | release_mem_region(res->start, res->end - res->start + 1); |
654 | dev_set_drvdata(dev, NULL); | 652 | platform_set_drvdata(pdev, NULL); |
655 | 653 | ||
656 | return 0; | 654 | return 0; |
657 | } | 655 | } |
658 | 656 | ||
659 | void imxfb_shutdown(struct device * dev) | 657 | void imxfb_shutdown(struct platform_device * dev) |
660 | { | 658 | { |
661 | struct fb_info *info = dev_get_drvdata(dev); | 659 | struct fb_info *info = platform_get_drvdata(dev); |
662 | struct imxfb_info *fbi = info->par; | 660 | struct imxfb_info *fbi = info->par; |
663 | imxfb_disable_controller(fbi); | 661 | imxfb_disable_controller(fbi); |
664 | } | 662 | } |
665 | 663 | ||
666 | static struct device_driver imxfb_driver = { | 664 | static struct platform_driver imxfb_driver = { |
667 | .name = "imx-fb", | ||
668 | .bus = &platform_bus_type, | ||
669 | .probe = imxfb_probe, | 665 | .probe = imxfb_probe, |
670 | .suspend = imxfb_suspend, | 666 | .suspend = imxfb_suspend, |
671 | .resume = imxfb_resume, | 667 | .resume = imxfb_resume, |
672 | .remove = imxfb_remove, | 668 | .remove = imxfb_remove, |
673 | .shutdown = imxfb_shutdown, | 669 | .shutdown = imxfb_shutdown, |
670 | .driver = { | ||
671 | .name = "imx-fb", | ||
672 | }, | ||
674 | }; | 673 | }; |
675 | 674 | ||
676 | int __init imxfb_init(void) | 675 | int __init imxfb_init(void) |
677 | { | 676 | { |
678 | return driver_register(&imxfb_driver); | 677 | return platform_driver_register(&imxfb_driver); |
679 | } | 678 | } |
680 | 679 | ||
681 | static void __exit imxfb_cleanup(void) | 680 | static void __exit imxfb_cleanup(void) |
682 | { | 681 | { |
683 | driver_unregister(&imxfb_driver); | 682 | platform_driver_unregister(&imxfb_driver); |
684 | } | 683 | } |
685 | 684 | ||
686 | module_init(imxfb_init); | 685 | module_init(imxfb_init); |