diff options
Diffstat (limited to 'drivers/base/base.h')
-rw-r--r-- | drivers/base/base.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/base/base.h b/drivers/base/base.h index 9f50f1b545dc..ddc97496db4a 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h | |||
@@ -63,6 +63,32 @@ struct class_private { | |||
63 | #define to_class(obj) \ | 63 | #define to_class(obj) \ |
64 | container_of(obj, struct class_private, class_subsys.kobj) | 64 | container_of(obj, struct class_private, class_subsys.kobj) |
65 | 65 | ||
66 | /** | ||
67 | * struct device_private - structure to hold the private to the driver core portions of the device structure. | ||
68 | * | ||
69 | * @klist_children - klist containing all children of this device | ||
70 | * @knode_parent - node in sibling list | ||
71 | * @knode_driver - node in driver list | ||
72 | * @knode_bus - node in bus list | ||
73 | * @device - pointer back to the struct class that this structure is | ||
74 | * associated with. | ||
75 | * | ||
76 | * Nothing outside of the driver core should ever touch these fields. | ||
77 | */ | ||
78 | struct device_private { | ||
79 | struct klist klist_children; | ||
80 | struct klist_node knode_parent; | ||
81 | struct klist_node knode_driver; | ||
82 | struct klist_node knode_bus; | ||
83 | struct device *device; | ||
84 | }; | ||
85 | #define to_device_private_parent(obj) \ | ||
86 | container_of(obj, struct device_private, knode_parent) | ||
87 | #define to_device_private_driver(obj) \ | ||
88 | container_of(obj, struct device_private, knode_driver) | ||
89 | #define to_device_private_bus(obj) \ | ||
90 | container_of(obj, struct device_private, knode_bus) | ||
91 | |||
66 | /* initialisation functions */ | 92 | /* initialisation functions */ |
67 | extern int devices_init(void); | 93 | extern int devices_init(void); |
68 | extern int buses_init(void); | 94 | extern int buses_init(void); |
@@ -86,6 +112,11 @@ extern void bus_remove_driver(struct device_driver *drv); | |||
86 | 112 | ||
87 | extern void driver_detach(struct device_driver *drv); | 113 | extern void driver_detach(struct device_driver *drv); |
88 | extern int driver_probe_device(struct device_driver *drv, struct device *dev); | 114 | extern int driver_probe_device(struct device_driver *drv, struct device *dev); |
115 | static inline int driver_match_device(struct device_driver *drv, | ||
116 | struct device *dev) | ||
117 | { | ||
118 | return drv->bus->match && drv->bus->match(dev, drv); | ||
119 | } | ||
89 | 120 | ||
90 | extern void sysdev_shutdown(void); | 121 | extern void sysdev_shutdown(void); |
91 | 122 | ||