1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19struct bus_type_private {
20 struct kset subsys;
21 struct kset *drivers_kset;
22 struct kset *devices_kset;
23 struct klist klist_devices;
24 struct klist klist_drivers;
25 struct blocking_notifier_head bus_notifier;
26 unsigned int drivers_autoprobe:1;
27 struct bus_type *bus;
28};
29
30struct driver_private {
31 struct kobject kobj;
32 struct klist klist_devices;
33 struct klist_node knode_bus;
34 struct module_kobject *mkobj;
35 struct device_driver *driver;
36};
37#define to_driver(obj) container_of(obj, struct driver_private, kobj)
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55struct class_private {
56 struct kset class_subsys;
57 struct klist class_devices;
58 struct list_head class_interfaces;
59 struct kset class_dirs;
60 struct mutex class_mutex;
61 struct class *class;
62};
63#define to_class(obj) \
64 container_of(obj, struct class_private, class_subsys.kobj)
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80struct device_private {
81 struct klist klist_children;
82 struct klist_node knode_parent;
83 struct klist_node knode_driver;
84 struct klist_node knode_bus;
85 void *driver_data;
86 struct device *device;
87};
88#define to_device_private_parent(obj) \
89 container_of(obj, struct device_private, knode_parent)
90#define to_device_private_driver(obj) \
91 container_of(obj, struct device_private, knode_driver)
92#define to_device_private_bus(obj) \
93 container_of(obj, struct device_private, knode_bus)
94
95extern int device_private_init(struct device *dev);
96
97
98extern int devices_init(void);
99extern int buses_init(void);
100extern int classes_init(void);
101extern int firmware_init(void);
102#ifdef CONFIG_SYS_HYPERVISOR
103extern int hypervisor_init(void);
104#else
105static inline int hypervisor_init(void) { return 0; }
106#endif
107extern int platform_bus_init(void);
108extern int system_bus_init(void);
109extern int cpu_dev_init(void);
110
111extern int bus_add_device(struct device *dev);
112extern void bus_probe_device(struct device *dev);
113extern void bus_remove_device(struct device *dev);
114
115extern int bus_add_driver(struct device_driver *drv);
116extern void bus_remove_driver(struct device_driver *drv);
117
118extern void driver_detach(struct device_driver *drv);
119extern int driver_probe_device(struct device_driver *drv, struct device *dev);
120static inline int driver_match_device(struct device_driver *drv,
121 struct device *dev)
122{
123 return drv->bus->match ? drv->bus->match(dev, drv) : 1;
124}
125
126extern void sysdev_shutdown(void);
127
128extern char *make_class_name(const char *name, struct kobject *kobj);
129
130extern int devres_release_all(struct device *dev);
131
132extern struct kset *devices_kset;
133
134#if defined(CONFIG_MODULES) && defined(CONFIG_SYSFS)
135extern void module_add_driver(struct module *mod, struct device_driver *drv);
136extern void module_remove_driver(struct device_driver *drv);
137#else
138static inline void module_add_driver(struct module *mod,
139 struct device_driver *drv) { }
140static inline void module_remove_driver(struct device_driver *drv) { }
141#endif
142
143#ifdef CONFIG_DEVTMPFS
144extern int devtmpfs_init(void);
145#else
146static inline int devtmpfs_init(void) { return 0; }
147#endif
148