aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/s1d13xxxfb.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-11-09 17:32:44 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-11-09 17:32:44 -0500
commit3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch)
treed8825be54cefb6ad6707478d719c8e30605bee7b /drivers/video/s1d13xxxfb.c
parent00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (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/s1d13xxxfb.c')
-rw-r--r--drivers/video/s1d13xxxfb.c49
1 files changed, 24 insertions, 25 deletions
diff --git a/drivers/video/s1d13xxxfb.c b/drivers/video/s1d13xxxfb.c
index 3edbd14c5c46..e5d0f92eeae3 100644
--- a/drivers/video/s1d13xxxfb.c
+++ b/drivers/video/s1d13xxxfb.c
@@ -503,10 +503,9 @@ s1d13xxxfb_fetch_hw_state(struct fb_info *info)
503 503
504 504
505static int 505static int
506s1d13xxxfb_remove(struct device *dev) 506s1d13xxxfb_remove(struct platform_device *pdev)
507{ 507{
508 struct fb_info *info = dev_get_drvdata(dev); 508 struct fb_info *info = platform_get_drvdata(pdev);
509 struct platform_device *pdev = to_platform_device(dev);
510 struct s1d13xxxfb_par *par = NULL; 509 struct s1d13xxxfb_par *par = NULL;
511 510
512 if (info) { 511 if (info) {
@@ -534,9 +533,8 @@ s1d13xxxfb_remove(struct device *dev)
534} 533}
535 534
536static int __devinit 535static int __devinit
537s1d13xxxfb_probe(struct device *dev) 536s1d13xxxfb_probe(struct platform_device *pdev)
538{ 537{
539 struct platform_device *pdev = to_platform_device(dev);
540 struct s1d13xxxfb_par *default_par; 538 struct s1d13xxxfb_par *default_par;
541 struct fb_info *info; 539 struct fb_info *info;
542 struct s1d13xxxfb_pdata *pdata = NULL; 540 struct s1d13xxxfb_pdata *pdata = NULL;
@@ -548,8 +546,8 @@ s1d13xxxfb_probe(struct device *dev)
548 printk(KERN_INFO "Epson S1D13XXX FB Driver\n"); 546 printk(KERN_INFO "Epson S1D13XXX FB Driver\n");
549 547
550 /* enable platform-dependent hardware glue, if any */ 548 /* enable platform-dependent hardware glue, if any */
551 if (dev->platform_data) 549 if (pdev->dev.platform_data)
552 pdata = dev->platform_data; 550 pdata = pdev->dev.platform_data;
553 551
554 if (pdata && pdata->platform_init_video) 552 if (pdata && pdata->platform_init_video)
555 pdata->platform_init_video(); 553 pdata->platform_init_video();
@@ -572,14 +570,14 @@ s1d13xxxfb_probe(struct device *dev)
572 570
573 if (!request_mem_region(pdev->resource[0].start, 571 if (!request_mem_region(pdev->resource[0].start,
574 pdev->resource[0].end - pdev->resource[0].start +1, "s1d13xxxfb mem")) { 572 pdev->resource[0].end - pdev->resource[0].start +1, "s1d13xxxfb mem")) {
575 dev_dbg(dev, "request_mem_region failed\n"); 573 dev_dbg(&pdev->dev, "request_mem_region failed\n");
576 ret = -EBUSY; 574 ret = -EBUSY;
577 goto bail; 575 goto bail;
578 } 576 }
579 577
580 if (!request_mem_region(pdev->resource[1].start, 578 if (!request_mem_region(pdev->resource[1].start,
581 pdev->resource[1].end - pdev->resource[1].start +1, "s1d13xxxfb regs")) { 579 pdev->resource[1].end - pdev->resource[1].start +1, "s1d13xxxfb regs")) {
582 dev_dbg(dev, "request_mem_region failed\n"); 580 dev_dbg(&pdev->dev, "request_mem_region failed\n");
583 ret = -EBUSY; 581 ret = -EBUSY;
584 goto bail; 582 goto bail;
585 } 583 }
@@ -640,7 +638,7 @@ s1d13xxxfb_probe(struct device *dev)
640 goto bail; 638 goto bail;
641 } 639 }
642 640
643 dev_set_drvdata(&pdev->dev, info); 641 platform_set_drvdata(pdev, info);
644 642
645 printk(KERN_INFO "fb%d: %s frame buffer device\n", 643 printk(KERN_INFO "fb%d: %s frame buffer device\n",
646 info->node, info->fix.id); 644 info->node, info->fix.id);
@@ -648,15 +646,15 @@ s1d13xxxfb_probe(struct device *dev)
648 return 0; 646 return 0;
649 647
650bail: 648bail:
651 s1d13xxxfb_remove(dev); 649 s1d13xxxfb_remove(pdev);
652 return ret; 650 return ret;
653 651
654} 652}
655 653
656#ifdef CONFIG_PM 654#ifdef CONFIG_PM
657static int s1d13xxxfb_suspend(struct device *dev, pm_message_t state) 655static int s1d13xxxfb_suspend(struct platform_device *dev, pm_message_t state)
658{ 656{
659 struct fb_info *info = dev_get_drvdata(dev); 657 struct fb_info *info = platform_get_drvdata(dev);
660 struct s1d13xxxfb_par *s1dfb = info->par; 658 struct s1d13xxxfb_par *s1dfb = info->par;
661 struct s1d13xxxfb_pdata *pdata = NULL; 659 struct s1d13xxxfb_pdata *pdata = NULL;
662 660
@@ -664,8 +662,8 @@ static int s1d13xxxfb_suspend(struct device *dev, pm_message_t state)
664 lcd_enable(s1dfb, 0); 662 lcd_enable(s1dfb, 0);
665 crt_enable(s1dfb, 0); 663 crt_enable(s1dfb, 0);
666 664
667 if (dev->platform_data) 665 if (dev->dev.platform_data)
668 pdata = dev->platform_data; 666 pdata = dev->dev.platform_data;
669 667
670#if 0 668#if 0
671 if (!s1dfb->disp_save) 669 if (!s1dfb->disp_save)
@@ -701,9 +699,9 @@ static int s1d13xxxfb_suspend(struct device *dev, pm_message_t state)
701 return 0; 699 return 0;
702} 700}
703 701
704static int s1d13xxxfb_resume(struct device *dev) 702static int s1d13xxxfb_resume(struct platform_device *dev)
705{ 703{
706 struct fb_info *info = dev_get_drvdata(dev); 704 struct fb_info *info = platform_get_drvdata(dev);
707 struct s1d13xxxfb_par *s1dfb = info->par; 705 struct s1d13xxxfb_par *s1dfb = info->par;
708 struct s1d13xxxfb_pdata *pdata = NULL; 706 struct s1d13xxxfb_pdata *pdata = NULL;
709 707
@@ -714,8 +712,8 @@ static int s1d13xxxfb_resume(struct device *dev)
714 while ((s1d13xxxfb_readreg(s1dfb, S1DREG_PS_STATUS) & 0x01)) 712 while ((s1d13xxxfb_readreg(s1dfb, S1DREG_PS_STATUS) & 0x01))
715 udelay(10); 713 udelay(10);
716 714
717 if (dev->platform_data) 715 if (dev->dev.platform_data)
718 pdata = dev->platform_data; 716 pdata = dev->dev.platform_data;
719 717
720 if (s1dfb->regs_save) { 718 if (s1dfb->regs_save) {
721 /* will write RO regs, *should* get away with it :) */ 719 /* will write RO regs, *should* get away with it :) */
@@ -741,15 +739,16 @@ static int s1d13xxxfb_resume(struct device *dev)
741} 739}
742#endif /* CONFIG_PM */ 740#endif /* CONFIG_PM */
743 741
744static struct device_driver s1d13xxxfb_driver = { 742static struct platform_driver s1d13xxxfb_driver = {
745 .name = S1D_DEVICENAME,
746 .bus = &platform_bus_type,
747 .probe = s1d13xxxfb_probe, 743 .probe = s1d13xxxfb_probe,
748 .remove = s1d13xxxfb_remove, 744 .remove = s1d13xxxfb_remove,
749#ifdef CONFIG_PM 745#ifdef CONFIG_PM
750 .suspend = s1d13xxxfb_suspend, 746 .suspend = s1d13xxxfb_suspend,
751 .resume = s1d13xxxfb_resume 747 .resume = s1d13xxxfb_resume,
752#endif 748#endif
749 .driver = {
750 .name = S1D_DEVICENAME,
751 },
753}; 752};
754 753
755 754
@@ -759,14 +758,14 @@ s1d13xxxfb_init(void)
759 if (fb_get_options("s1d13xxxfb", NULL)) 758 if (fb_get_options("s1d13xxxfb", NULL))
760 return -ENODEV; 759 return -ENODEV;
761 760
762 return driver_register(&s1d13xxxfb_driver); 761 return platform_driver_register(&s1d13xxxfb_driver);
763} 762}
764 763
765 764
766static void __exit 765static void __exit
767s1d13xxxfb_exit(void) 766s1d13xxxfb_exit(void)
768{ 767{
769 driver_unregister(&s1d13xxxfb_driver); 768 platform_driver_unregister(&s1d13xxxfb_driver);
770} 769}
771 770
772module_init(s1d13xxxfb_init); 771module_init(s1d13xxxfb_init);