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/s3c2410fb.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/s3c2410fb.c')
-rw-r--r-- | drivers/video/s3c2410fb.c | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c index 855a6778b9eb..ce6e749db3a7 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c | |||
@@ -634,19 +634,18 @@ static irqreturn_t s3c2410fb_irq(int irq, void *dev_id, struct pt_regs *r) | |||
634 | 634 | ||
635 | static char driver_name[]="s3c2410fb"; | 635 | static char driver_name[]="s3c2410fb"; |
636 | 636 | ||
637 | int __init s3c2410fb_probe(struct device *dev) | 637 | int __init s3c2410fb_probe(struct platform_device *pdev) |
638 | { | 638 | { |
639 | struct s3c2410fb_info *info; | 639 | struct s3c2410fb_info *info; |
640 | struct fb_info *fbinfo; | 640 | struct fb_info *fbinfo; |
641 | struct platform_device *pdev = to_platform_device(dev); | ||
642 | struct s3c2410fb_hw *mregs; | 641 | struct s3c2410fb_hw *mregs; |
643 | int ret; | 642 | int ret; |
644 | int irq; | 643 | int irq; |
645 | int i; | 644 | int i; |
646 | 645 | ||
647 | mach_info = dev->platform_data; | 646 | mach_info = pdev->dev.platform_data; |
648 | if (mach_info == NULL) { | 647 | if (mach_info == NULL) { |
649 | dev_err(dev,"no platform data for lcd, cannot attach\n"); | 648 | dev_err(&pdev->dev,"no platform data for lcd, cannot attach\n"); |
650 | return -EINVAL; | 649 | return -EINVAL; |
651 | } | 650 | } |
652 | 651 | ||
@@ -654,11 +653,11 @@ int __init s3c2410fb_probe(struct device *dev) | |||
654 | 653 | ||
655 | irq = platform_get_irq(pdev, 0); | 654 | irq = platform_get_irq(pdev, 0); |
656 | if (irq < 0) { | 655 | if (irq < 0) { |
657 | dev_err(dev, "no irq for device\n"); | 656 | dev_err(&pdev->dev, "no irq for device\n"); |
658 | return -ENOENT; | 657 | return -ENOENT; |
659 | } | 658 | } |
660 | 659 | ||
661 | fbinfo = framebuffer_alloc(sizeof(struct s3c2410fb_info), dev); | 660 | fbinfo = framebuffer_alloc(sizeof(struct s3c2410fb_info), &pdev->dev); |
662 | if (!fbinfo) { | 661 | if (!fbinfo) { |
663 | return -ENOMEM; | 662 | return -ENOMEM; |
664 | } | 663 | } |
@@ -666,7 +665,7 @@ int __init s3c2410fb_probe(struct device *dev) | |||
666 | 665 | ||
667 | info = fbinfo->par; | 666 | info = fbinfo->par; |
668 | info->fb = fbinfo; | 667 | info->fb = fbinfo; |
669 | dev_set_drvdata(dev, fbinfo); | 668 | platform_set_drvdata(pdev, fbinfo); |
670 | 669 | ||
671 | s3c2410fb_init_registers(info); | 670 | s3c2410fb_init_registers(info); |
672 | 671 | ||
@@ -676,7 +675,7 @@ int __init s3c2410fb_probe(struct device *dev) | |||
676 | 675 | ||
677 | memcpy(&info->regs, &mach_info->regs, sizeof(info->regs)); | 676 | memcpy(&info->regs, &mach_info->regs, sizeof(info->regs)); |
678 | 677 | ||
679 | info->mach_info = dev->platform_data; | 678 | info->mach_info = pdev->dev.platform_data; |
680 | 679 | ||
681 | fbinfo->fix.type = FB_TYPE_PACKED_PIXELS; | 680 | fbinfo->fix.type = FB_TYPE_PACKED_PIXELS; |
682 | fbinfo->fix.type_aux = 0; | 681 | fbinfo->fix.type_aux = 0; |
@@ -735,7 +734,7 @@ int __init s3c2410fb_probe(struct device *dev) | |||
735 | 734 | ||
736 | ret = request_irq(irq, s3c2410fb_irq, SA_INTERRUPT, pdev->name, info); | 735 | ret = request_irq(irq, s3c2410fb_irq, SA_INTERRUPT, pdev->name, info); |
737 | if (ret) { | 736 | if (ret) { |
738 | dev_err(dev, "cannot get irq %d - err %d\n", irq, ret); | 737 | dev_err(&pdev->dev, "cannot get irq %d - err %d\n", irq, ret); |
739 | ret = -EBUSY; | 738 | ret = -EBUSY; |
740 | goto release_mem; | 739 | goto release_mem; |
741 | } | 740 | } |
@@ -773,7 +772,7 @@ int __init s3c2410fb_probe(struct device *dev) | |||
773 | } | 772 | } |
774 | 773 | ||
775 | /* create device files */ | 774 | /* create device files */ |
776 | device_create_file(dev, &dev_attr_debug); | 775 | device_create_file(&pdev->dev, &dev_attr_debug); |
777 | 776 | ||
778 | printk(KERN_INFO "fb%d: %s frame buffer device\n", | 777 | printk(KERN_INFO "fb%d: %s frame buffer device\n", |
779 | fbinfo->node, fbinfo->fix.id); | 778 | fbinfo->node, fbinfo->fix.id); |
@@ -816,10 +815,9 @@ static void s3c2410fb_stop_lcd(void) | |||
816 | /* | 815 | /* |
817 | * Cleanup | 816 | * Cleanup |
818 | */ | 817 | */ |
819 | static int s3c2410fb_remove(struct device *dev) | 818 | static int s3c2410fb_remove(struct platform_device *pdev) |
820 | { | 819 | { |
821 | struct platform_device *pdev = to_platform_device(dev); | 820 | struct fb_info *fbinfo = platform_get_drvdata(pdev); |
822 | struct fb_info *fbinfo = dev_get_drvdata(dev); | ||
823 | struct s3c2410fb_info *info = fbinfo->par; | 821 | struct s3c2410fb_info *info = fbinfo->par; |
824 | int irq; | 822 | int irq; |
825 | 823 | ||
@@ -847,9 +845,9 @@ static int s3c2410fb_remove(struct device *dev) | |||
847 | 845 | ||
848 | /* suspend and resume support for the lcd controller */ | 846 | /* suspend and resume support for the lcd controller */ |
849 | 847 | ||
850 | static int s3c2410fb_suspend(struct device *dev, pm_message_t state) | 848 | static int s3c2410fb_suspend(struct platform_device *dev, pm_message_t state) |
851 | { | 849 | { |
852 | struct fb_info *fbinfo = dev_get_drvdata(dev); | 850 | struct fb_info *fbinfo = platform_get_drvdata(dev); |
853 | struct s3c2410fb_info *info = fbinfo->par; | 851 | struct s3c2410fb_info *info = fbinfo->par; |
854 | 852 | ||
855 | s3c2410fb_stop_lcd(); | 853 | s3c2410fb_stop_lcd(); |
@@ -864,9 +862,9 @@ static int s3c2410fb_suspend(struct device *dev, pm_message_t state) | |||
864 | return 0; | 862 | return 0; |
865 | } | 863 | } |
866 | 864 | ||
867 | static int s3c2410fb_resume(struct device *dev) | 865 | static int s3c2410fb_resume(struct platform_device *dev) |
868 | { | 866 | { |
869 | struct fb_info *fbinfo = dev_get_drvdata(dev); | 867 | struct fb_info *fbinfo = platform_get_drvdata(dev); |
870 | struct s3c2410fb_info *info = fbinfo->par; | 868 | struct s3c2410fb_info *info = fbinfo->par; |
871 | 869 | ||
872 | clk_enable(info->clk); | 870 | clk_enable(info->clk); |
@@ -882,24 +880,25 @@ static int s3c2410fb_resume(struct device *dev) | |||
882 | #define s3c2410fb_resume NULL | 880 | #define s3c2410fb_resume NULL |
883 | #endif | 881 | #endif |
884 | 882 | ||
885 | static struct device_driver s3c2410fb_driver = { | 883 | static struct platform_driver s3c2410fb_driver = { |
886 | .name = "s3c2410-lcd", | ||
887 | .owner = THIS_MODULE, | ||
888 | .bus = &platform_bus_type, | ||
889 | .probe = s3c2410fb_probe, | 884 | .probe = s3c2410fb_probe, |
885 | .remove = s3c2410fb_remove, | ||
890 | .suspend = s3c2410fb_suspend, | 886 | .suspend = s3c2410fb_suspend, |
891 | .resume = s3c2410fb_resume, | 887 | .resume = s3c2410fb_resume, |
892 | .remove = s3c2410fb_remove | 888 | .driver = { |
889 | .name = "s3c2410-lcd", | ||
890 | .owner = THIS_MODULE, | ||
891 | }, | ||
893 | }; | 892 | }; |
894 | 893 | ||
895 | int __devinit s3c2410fb_init(void) | 894 | int __devinit s3c2410fb_init(void) |
896 | { | 895 | { |
897 | return driver_register(&s3c2410fb_driver); | 896 | return platform_driver_register(&s3c2410fb_driver); |
898 | } | 897 | } |
899 | 898 | ||
900 | static void __exit s3c2410fb_cleanup(void) | 899 | static void __exit s3c2410fb_cleanup(void) |
901 | { | 900 | { |
902 | driver_unregister(&s3c2410fb_driver); | 901 | platform_driver_unregister(&s3c2410fb_driver); |
903 | } | 902 | } |
904 | 903 | ||
905 | 904 | ||