diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2010-07-29 19:55:50 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2010-08-01 03:44:18 -0400 |
commit | 7fb8f881c54beb05dd4d2c947dada1c636581d87 (patch) | |
tree | f3a823a5bcb4cc6bc1ed3c2dbc5a02582c9ecb22 /drivers/of/platform.c | |
parent | 22ae782f86b726f9cea752c0f269ff6dcdf2f6e1 (diff) |
of/platform: Register of_platform_drivers with an "of:" prefix
Currently there are some drivers in tree which register both a
platform_driver and an of_platform_driver with the same name. This is
a temporary situation until all the relevant of_platform_drivers are
converted to be normal platform_drivers. Until then, this patch gives
all the of_platform_drivers an "of:" prefix to protect against bogus
matches and namespace conflicts.
Diffstat (limited to 'drivers/of/platform.c')
-rw-r--r-- | drivers/of/platform.c | 16 |
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 | */ |
75 | int of_register_platform_driver(struct of_platform_driver *drv) | 75 | int 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); | |||
91 | void of_unregister_platform_driver(struct of_platform_driver *drv) | 105 | void 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 | } |
95 | EXPORT_SYMBOL(of_unregister_platform_driver); | 111 | EXPORT_SYMBOL(of_unregister_platform_driver); |
96 | 112 | ||