Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

skeletonfb: update to correct platform driver usage

It updates skeletonfb to new platform driver API. The skeletonfb is
templates for creating new drivers.

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Krzysztof Helt and committed by
Linus Torvalds
84c41ce8 a882ef47

+20 -17
+20 -17
drivers/video/skeletonfb.c
··· 675 675 * Initialization 676 676 */ 677 677 678 - /* static int __init xxfb_probe (struct device *device) -- for platform devs */ 678 + /* static int __init xxfb_probe (struct platform_device *pdev) -- for platform devs */ 679 679 static int __devinit xxxfb_probe(struct pci_dev *dev, 680 680 const struct pci_device_id *ent) 681 681 { 682 682 struct fb_info *info; 683 683 struct xxx_par *par; 684 - struct device* device = &dev->dev; /* for pci drivers */ 684 + struct device *device = &dev->dev; /* or &pdev->dev */ 685 685 int cmap_len, retval; 686 686 687 687 /* ··· 824 824 return -EINVAL; 825 825 printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, 826 826 info->fix.id); 827 - pci_set_drvdata(dev, info); /* or dev_set_drvdata(device, info) */ 827 + pci_set_drvdata(dev, info); /* or platform_set_drvdata(pdev, info) */ 828 828 return 0; 829 829 } 830 830 831 831 /* 832 832 * Cleanup 833 833 */ 834 - /* static void __devexit xxxfb_remove(struct device *device) */ 834 + /* static void __devexit xxxfb_remove(struct platform_device *pdev) */ 835 835 static void __devexit xxxfb_remove(struct pci_dev *dev) 836 836 { 837 837 struct fb_info *info = pci_get_drvdata(dev); 838 - /* or dev_get_drvdata(device); */ 838 + /* or platform_get_drvdata(pdev); */ 839 839 840 840 if (info) { 841 841 unregister_framebuffer(info); ··· 961 961 #define xxxfb_resume NULL 962 962 #endif /* CONFIG_PM */ 963 963 964 - static struct device_driver xxxfb_driver = { 965 - .name = "xxxfb", 966 - .bus = &platform_bus_type, 964 + static struct platform_device_driver xxxfb_driver = { 967 965 .probe = xxxfb_probe, 968 966 .remove = xxxfb_remove, 969 967 .suspend = xxxfb_suspend, /* optional but recommended */ 970 968 .resume = xxxfb_resume, /* optional but recommended */ 969 + .driver = { 970 + .name = "xxxfb", 971 + }, 971 972 }; 972 973 973 - static struct platform_device xxxfb_device = { 974 - .name = "xxxfb", 975 - }; 974 + static struct platform_device *xxxfb_device; 976 975 977 976 #ifndef MODULE 978 977 /* ··· 1001 1002 return -ENODEV; 1002 1003 xxxfb_setup(option); 1003 1004 #endif 1004 - ret = driver_register(&xxxfb_driver); 1005 + ret = platform_driver_register(&xxxfb_driver); 1005 1006 1006 1007 if (!ret) { 1007 - ret = platform_device_register(&xxxfb_device); 1008 - if (ret) 1009 - driver_unregister(&xxxfb_driver); 1008 + xxxfb_device = platform_device_register_simple("xxxfb", 0, 1009 + NULL, 0); 1010 + 1011 + if (IS_ERR(xxxfb_device)) { 1012 + platform_driver_unregister(&xxxfb_driver); 1013 + ret = PTR_ERR(xxxfb_device); 1014 + } 1010 1015 } 1011 1016 1012 1017 return ret; ··· 1018 1015 1019 1016 static void __exit xxxfb_exit(void) 1020 1017 { 1021 - platform_device_unregister(&xxxfb_device); 1022 - driver_unregister(&xxxfb_driver); 1018 + platform_device_unregister(xxxfb_device); 1019 + platform_driver_unregister(&xxxfb_driver); 1023 1020 } 1024 1021 #endif /* CONFIG_PCI */ 1025 1022