提交 20cecf6a 编写于 作者: A Antonino A. Daplas 提交者: Linus Torvalds

[PATCH] vfb: Update platform code

Update platform code to dynamically allocate the platform device
Signed-off-by: NAntonino Daplas <adaplas@pol.net>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 103edf02
...@@ -398,12 +398,6 @@ static int __init vfb_setup(char *options) ...@@ -398,12 +398,6 @@ static int __init vfb_setup(char *options)
* Initialisation * Initialisation
*/ */
static void vfb_platform_release(struct device *device)
{
// This is called when the reference count goes to zero.
dev_err(device, "This driver is broken, please bug the authors so they will fix it.\n");
}
static int __init vfb_probe(struct platform_device *dev) static int __init vfb_probe(struct platform_device *dev)
{ {
struct fb_info *info; struct fb_info *info;
...@@ -482,13 +476,7 @@ static struct platform_driver vfb_driver = { ...@@ -482,13 +476,7 @@ static struct platform_driver vfb_driver = {
}, },
}; };
static struct platform_device vfb_device = { static struct platform_device *vfb_device;
.name = "vfb",
.id = 0,
.dev = {
.release = vfb_platform_release,
}
};
static int __init vfb_init(void) static int __init vfb_init(void)
{ {
...@@ -508,10 +496,19 @@ static int __init vfb_init(void) ...@@ -508,10 +496,19 @@ static int __init vfb_init(void)
ret = platform_driver_register(&vfb_driver); ret = platform_driver_register(&vfb_driver);
if (!ret) { if (!ret) {
ret = platform_device_register(&vfb_device); vfb_device = platform_device_alloc("vfb", 0);
if (ret)
if (vfb_device)
ret = platform_device_add(vfb_device);
else
ret = -ENOMEM;
if (ret) {
platform_device_put(vfb_device);
platform_driver_unregister(&vfb_driver); platform_driver_unregister(&vfb_driver);
}
} }
return ret; return ret;
} }
...@@ -520,7 +517,7 @@ module_init(vfb_init); ...@@ -520,7 +517,7 @@ module_init(vfb_init);
#ifdef MODULE #ifdef MODULE
static void __exit vfb_exit(void) static void __exit vfb_exit(void)
{ {
platform_device_unregister(&vfb_device); platform_device_unregister(vfb_device);
platform_driver_unregister(&vfb_driver); platform_driver_unregister(&vfb_driver);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册