aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/of_platform.h
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-06-08 09:48:21 -0400
committerGrant Likely <grant.likely@secretlab.ca>2010-07-24 11:57:51 -0400
commiteca3930163ba8884060ce9d9ff5ef0d9b7c7b00f (patch)
tree5774d6d53b5f7d8f069e82b3937cdff7b3d45bbe /include/linux/of_platform.h
parent05212157e94ccf4cf458413bbba509cfa95ff92b (diff)
of: Merge of_platform_bus_type with platform_bus_type
of_platform_bus was being used in the same manner as the platform_bus. The only difference being that of_platform_bus devices are generated from data in the device tree, and platform_bus devices are usually statically allocated in platform code. Having them separate causes the problem of device drivers having to be registered twice if it was possible for the same device to appear on either bus. This patch removes of_platform_bus_type and registers all of_platform bus devices and drivers on the platform bus instead. A previous patch made the of_device structure an alias for the platform_device structure, and a shim is used to adapt of_platform_drivers to the platform bus. After all of of_platform_bus drivers are converted to be normal platform drivers, the shim code can be removed. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/of_platform.h')
-rw-r--r--include/linux/of_platform.h21
1 files changed, 8 insertions, 13 deletions
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index a51fd30176aa..133ecf31a60f 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -17,19 +17,19 @@
17#include <linux/mod_devicetable.h> 17#include <linux/mod_devicetable.h>
18#include <linux/pm.h> 18#include <linux/pm.h>
19#include <linux/of_device.h> 19#include <linux/of_device.h>
20#include <linux/platform_device.h>
20 21
21/* 22/*
22 * The of_platform_bus_type is a bus type used by drivers that do not 23 * of_platform_bus_type isn't it's own bus anymore. It's now just an alias
23 * attach to a macio or similar bus but still use OF probing 24 * for the platform bus.
24 * mechanism
25 */ 25 */
26extern struct bus_type of_platform_bus_type; 26#define of_platform_bus_type platform_bus_type
27 27
28extern const struct of_device_id of_default_bus_ids[]; 28extern const struct of_device_id of_default_bus_ids[];
29 29
30/* 30/*
31 * An of_platform_driver driver is attached to a basic of_device on 31 * An of_platform_driver driver is attached to a basic of_device on
32 * the "platform bus" (of_platform_bus_type). 32 * the "platform bus" (platform_bus_type).
33 */ 33 */
34struct of_platform_driver 34struct of_platform_driver
35{ 35{
@@ -42,6 +42,7 @@ struct of_platform_driver
42 int (*shutdown)(struct of_device* dev); 42 int (*shutdown)(struct of_device* dev);
43 43
44 struct device_driver driver; 44 struct device_driver driver;
45 struct platform_driver platform_driver;
45}; 46};
46#define to_of_platform_driver(drv) \ 47#define to_of_platform_driver(drv) \
47 container_of(drv,struct of_platform_driver, driver) 48 container_of(drv,struct of_platform_driver, driver)
@@ -51,14 +52,8 @@ extern int of_register_driver(struct of_platform_driver *drv,
51extern void of_unregister_driver(struct of_platform_driver *drv); 52extern void of_unregister_driver(struct of_platform_driver *drv);
52 53
53/* Platform drivers register/unregister */ 54/* Platform drivers register/unregister */
54static inline int of_register_platform_driver(struct of_platform_driver *drv) 55extern int of_register_platform_driver(struct of_platform_driver *drv);
55{ 56extern void of_unregister_platform_driver(struct of_platform_driver *drv);
56 return of_register_driver(drv, &of_platform_bus_type);
57}
58static inline void of_unregister_platform_driver(struct of_platform_driver *drv)
59{
60 of_unregister_driver(drv);
61}
62 57
63extern struct of_device *of_device_alloc(struct device_node *np, 58extern struct of_device *of_device_alloc(struct device_node *np,
64 const char *bus_id, 59 const char *bus_id,