Commit 84c41ce8 authored by Krzysztof Helt's avatar Krzysztof Helt Committed by Linus Torvalds

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: default avatarKrzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a882ef47
...@@ -675,13 +675,13 @@ static struct fb_ops xxxfb_ops = { ...@@ -675,13 +675,13 @@ static struct fb_ops xxxfb_ops = {
* Initialization * Initialization
*/ */
/* static int __init xxfb_probe (struct device *device) -- for platform devs */ /* static int __init xxfb_probe (struct platform_device *pdev) -- for platform devs */
static int __devinit xxxfb_probe(struct pci_dev *dev, static int __devinit xxxfb_probe(struct pci_dev *dev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
struct fb_info *info; struct fb_info *info;
struct xxx_par *par; struct xxx_par *par;
struct device* device = &dev->dev; /* for pci drivers */ struct device *device = &dev->dev; /* or &pdev->dev */
int cmap_len, retval; int cmap_len, retval;
/* /*
...@@ -824,18 +824,18 @@ static int __devinit xxxfb_probe(struct pci_dev *dev, ...@@ -824,18 +824,18 @@ static int __devinit xxxfb_probe(struct pci_dev *dev,
return -EINVAL; return -EINVAL;
printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node,
info->fix.id); info->fix.id);
pci_set_drvdata(dev, info); /* or dev_set_drvdata(device, info) */ pci_set_drvdata(dev, info); /* or platform_set_drvdata(pdev, info) */
return 0; return 0;
} }
/* /*
* Cleanup * Cleanup
*/ */
/* static void __devexit xxxfb_remove(struct device *device) */ /* static void __devexit xxxfb_remove(struct platform_device *pdev) */
static void __devexit xxxfb_remove(struct pci_dev *dev) static void __devexit xxxfb_remove(struct pci_dev *dev)
{ {
struct fb_info *info = pci_get_drvdata(dev); struct fb_info *info = pci_get_drvdata(dev);
/* or dev_get_drvdata(device); */ /* or platform_get_drvdata(pdev); */
if (info) { if (info) {
unregister_framebuffer(info); unregister_framebuffer(info);
...@@ -961,19 +961,18 @@ static int xxxfb_resume(struct platform_dev *dev) ...@@ -961,19 +961,18 @@ static int xxxfb_resume(struct platform_dev *dev)
#define xxxfb_resume NULL #define xxxfb_resume NULL
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
static struct device_driver xxxfb_driver = { static struct platform_device_driver xxxfb_driver = {
.name = "xxxfb",
.bus = &platform_bus_type,
.probe = xxxfb_probe, .probe = xxxfb_probe,
.remove = xxxfb_remove, .remove = xxxfb_remove,
.suspend = xxxfb_suspend, /* optional but recommended */ .suspend = xxxfb_suspend, /* optional but recommended */
.resume = xxxfb_resume, /* optional but recommended */ .resume = xxxfb_resume, /* optional but recommended */
}; .driver = {
static struct platform_device xxxfb_device = {
.name = "xxxfb", .name = "xxxfb",
},
}; };
static struct platform_device *xxxfb_device;
#ifndef MODULE #ifndef MODULE
/* /*
* Setup * Setup
...@@ -1002,12 +1001,16 @@ static int __init xxxfb_init(void) ...@@ -1002,12 +1001,16 @@ static int __init xxxfb_init(void)
return -ENODEV; return -ENODEV;
xxxfb_setup(option); xxxfb_setup(option);
#endif #endif
ret = driver_register(&xxxfb_driver); ret = platform_driver_register(&xxxfb_driver);
if (!ret) { if (!ret) {
ret = platform_device_register(&xxxfb_device); xxxfb_device = platform_device_register_simple("xxxfb", 0,
if (ret) NULL, 0);
driver_unregister(&xxxfb_driver);
if (IS_ERR(xxxfb_device)) {
platform_driver_unregister(&xxxfb_driver);
ret = PTR_ERR(xxxfb_device);
}
} }
return ret; return ret;
...@@ -1015,8 +1018,8 @@ static int __init xxxfb_init(void) ...@@ -1015,8 +1018,8 @@ static int __init xxxfb_init(void)
static void __exit xxxfb_exit(void) static void __exit xxxfb_exit(void)
{ {
platform_device_unregister(&xxxfb_device); platform_device_unregister(xxxfb_device);
driver_unregister(&xxxfb_driver); platform_driver_unregister(&xxxfb_driver);
} }
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment