From a4a41eab4f3643ffc8dfa56a32f8d9bd7e5aa9e7 Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Thu, 29 Jul 2010 17:55:50 -0600 Subject: [PATCH] --- yaml --- r: 204946 b: refs/heads/master c: 7fb8f881c54beb05dd4d2c947dada1c636581d87 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/of/platform.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 4f6cb0b0bea2..6a557f4cb41a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 22ae782f86b726f9cea752c0f269ff6dcdf2f6e1 +refs/heads/master: 7fb8f881c54beb05dd4d2c947dada1c636581d87 diff --git a/trunk/drivers/of/platform.c b/trunk/drivers/of/platform.c index 30a4641e798a..bb72223c22ae 100644 --- a/trunk/drivers/of/platform.c +++ b/trunk/drivers/of/platform.c @@ -74,8 +74,22 @@ static void platform_driver_shutdown_shim(struct platform_device *pdev) */ int of_register_platform_driver(struct of_platform_driver *drv) { + char *of_name; + /* setup of_platform_driver to platform_driver adaptors */ drv->platform_driver.driver = drv->driver; + + /* Prefix the driver name with 'of:' to avoid namespace collisions + * and bogus matches. There are some drivers in the tree that + * register both an of_platform_driver and a platform_driver with + * the same name. This is a temporary measure until they are all + * cleaned up --gcl July 29, 2010 */ + of_name = kmalloc(strlen(drv->driver.name) + 5, GFP_KERNEL); + if (!of_name) + return -ENOMEM; + sprintf(of_name, "of:%s", drv->driver.name); + drv->platform_driver.driver.name = of_name; + if (drv->probe) drv->platform_driver.probe = platform_driver_probe_shim; drv->platform_driver.remove = drv->remove; @@ -91,6 +105,8 @@ EXPORT_SYMBOL(of_register_platform_driver); void of_unregister_platform_driver(struct of_platform_driver *drv) { platform_driver_unregister(&drv->platform_driver); + kfree(drv->platform_driver.driver.name); + drv->platform_driver.driver.name = NULL; } EXPORT_SYMBOL(of_unregister_platform_driver);