aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of/platform.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/of/platform.c')
-rw-r--r--drivers/of/platform.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 30a4641e798a..bb72223c22ae 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -74,8 +74,22 @@ static void platform_driver_shutdown_shim(struct platform_device *pdev)
74 */ 74 */
75int of_register_platform_driver(struct of_platform_driver *drv) 75int of_register_platform_driver(struct of_platform_driver *drv)
76{ 76{
77 char *of_name;
78
77 /* setup of_platform_driver to platform_driver adaptors */ 79 /* setup of_platform_driver to platform_driver adaptors */
78 drv->platform_driver.driver = drv->driver; 80 drv->platform_driver.driver = drv->driver;
81
82 /* Prefix the driver name with 'of:' to avoid namespace collisions
83 * and bogus matches. There are some drivers in the tree that
84 * register both an of_platform_driver and a platform_driver with
85 * the same name. This is a temporary measure until they are all
86 * cleaned up --gcl July 29, 2010 */
87 of_name = kmalloc(strlen(drv->driver.name) + 5, GFP_KERNEL);
88 if (!of_name)
89 return -ENOMEM;
90 sprintf(of_name, "of:%s", drv->driver.name);
91 drv->platform_driver.driver.name = of_name;
92
79 if (drv->probe) 93 if (drv->probe)
80 drv->platform_driver.probe = platform_driver_probe_shim; 94 drv->platform_driver.probe = platform_driver_probe_shim;
81 drv->platform_driver.remove = drv->remove; 95 drv->platform_driver.remove = drv->remove;
@@ -91,6 +105,8 @@ EXPORT_SYMBOL(of_register_platform_driver);
91void of_unregister_platform_driver(struct of_platform_driver *drv) 105void of_unregister_platform_driver(struct of_platform_driver *drv)
92{ 106{
93 platform_driver_unregister(&drv->platform_driver); 107 platform_driver_unregister(&drv->platform_driver);
108 kfree(drv->platform_driver.driver.name);
109 drv->platform_driver.driver.name = NULL;
94} 110}
95EXPORT_SYMBOL(of_unregister_platform_driver); 111EXPORT_SYMBOL(of_unregister_platform_driver);
96 112