Blame view

drivers/base/base.h 5 KB
a1bdc7aad   Ben Dooks   [PATCH] drivers/b...
1

c6f7e72a3   Greg Kroah-Hartman   driver core: remo...
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  /**
   * struct bus_type_private - structure to hold the private to the driver core portions of the bus_type structure.
   *
   * @subsys - the struct kset that defines this bus.  This is the main kobject
   * @drivers_kset - the list of drivers associated with this bus
   * @devices_kset - the list of devices associated with this bus
   * @klist_devices - the klist to iterate over the @devices_kset
   * @klist_drivers - the klist to iterate over the @drivers_kset
   * @bus_notifier - the bus notifier list for anything that cares about things
   * on this bus.
   * @bus - pointer back to the struct bus_type that this structure is associated
   * with.
   *
   * This structure is the one that is the actual kobject allowing struct
   * bus_type to be statically allocated safely.  Nothing outside of the driver
   * core should ever touch these fields.
   */
  struct bus_type_private {
  	struct kset subsys;
  	struct kset *drivers_kset;
  	struct kset *devices_kset;
  	struct klist klist_devices;
  	struct klist klist_drivers;
  	struct blocking_notifier_head bus_notifier;
  	unsigned int drivers_autoprobe:1;
  	struct bus_type *bus;
  };
e5dd12784   Greg Kroah-Hartman   Driver core: move...
29
30
31
32
33
34
35
36
  struct driver_private {
  	struct kobject kobj;
  	struct klist klist_devices;
  	struct klist_node knode_bus;
  	struct module_kobject *mkobj;
  	struct device_driver *driver;
  };
  #define to_driver(obj) container_of(obj, struct driver_private, kobj)
a1bdc7aad   Ben Dooks   [PATCH] drivers/b...
37

7c71448b8   Greg Kroah-Hartman   class: move drive...
38
39
40
41
  
  /**
   * struct class_private - structure to hold the private to the driver core portions of the class structure.
   *
1fbfee6c6   Greg Kroah-Hartman   class: rename "su...
42
   * @class_subsys - the struct kset that defines this class.  This is the main kobject
97ae69fdb   Greg Kroah-Hartman   class: rename "de...
43
   * @class_devices - list of devices associated with this class
184f1f779   Greg Kroah-Hartman   class: rename "in...
44
   * @class_interfaces - list of class_interfaces associated with this class
1e4125086   Greg Kroah-Hartman   class: fix docboo...
45
   * @class_dirs - "glue" directory for virtual devices associated with this class
f75b1c60f   Dave Young   class: change int...
46
   * @class_mutex - mutex to protect the children, devices, and interfaces lists.
7c71448b8   Greg Kroah-Hartman   class: move drive...
47
48
49
50
51
52
53
54
   * @class - pointer back to the struct class that this structure is associated
   * with.
   *
   * This structure is the one that is the actual kobject allowing struct
   * class to be statically allocated safely.  Nothing outside of the driver
   * core should ever touch these fields.
   */
  struct class_private {
1fbfee6c6   Greg Kroah-Hartman   class: rename "su...
55
  	struct kset class_subsys;
5a3ceb861   Tejun Heo   driver-core: use ...
56
  	struct klist class_devices;
184f1f779   Greg Kroah-Hartman   class: rename "in...
57
  	struct list_head class_interfaces;
7c71448b8   Greg Kroah-Hartman   class: move drive...
58
  	struct kset class_dirs;
f75b1c60f   Dave Young   class: change int...
59
  	struct mutex class_mutex;
7c71448b8   Greg Kroah-Hartman   class: move drive...
60
61
  	struct class *class;
  };
1fbfee6c6   Greg Kroah-Hartman   class: rename "su...
62
63
  #define to_class(obj)	\
  	container_of(obj, struct class_private, class_subsys.kobj)
7c71448b8   Greg Kroah-Hartman   class: move drive...
64

fb069a5d1   Greg Kroah-Hartman   driver core: crea...
65
66
67
  /**
   * struct device_private - structure to hold the private to the driver core portions of the device structure.
   *
f791b8c83   Greg Kroah-Hartman   driver core: move...
68
69
   * @klist_children - klist containing all children of this device
   * @knode_parent - node in sibling list
8940b4f31   Greg Kroah-Hartman   driver core: move...
70
   * @knode_driver - node in driver list
ae1b41715   Greg Kroah-Hartman   driver core: move...
71
   * @knode_bus - node in bus list
b40284378   Greg Kroah-Hartman   Driver core: move...
72
73
   * @driver_data - private pointer for driver specific info.  Will turn into a
   * list soon.
fb069a5d1   Greg Kroah-Hartman   driver core: crea...
74
75
76
77
78
79
   * @device - pointer back to the struct class that this structure is
   * associated with.
   *
   * Nothing outside of the driver core should ever touch these fields.
   */
  struct device_private {
f791b8c83   Greg Kroah-Hartman   driver core: move...
80
81
  	struct klist klist_children;
  	struct klist_node knode_parent;
8940b4f31   Greg Kroah-Hartman   driver core: move...
82
  	struct klist_node knode_driver;
ae1b41715   Greg Kroah-Hartman   driver core: move...
83
  	struct klist_node knode_bus;
b40284378   Greg Kroah-Hartman   Driver core: move...
84
  	void *driver_data;
fb069a5d1   Greg Kroah-Hartman   driver core: crea...
85
86
  	struct device *device;
  };
f791b8c83   Greg Kroah-Hartman   driver core: move...
87
88
  #define to_device_private_parent(obj)	\
  	container_of(obj, struct device_private, knode_parent)
8940b4f31   Greg Kroah-Hartman   driver core: move...
89
90
  #define to_device_private_driver(obj)	\
  	container_of(obj, struct device_private, knode_driver)
ae1b41715   Greg Kroah-Hartman   driver core: move...
91
92
  #define to_device_private_bus(obj)	\
  	container_of(obj, struct device_private, knode_bus)
fb069a5d1   Greg Kroah-Hartman   driver core: crea...
93

b40284378   Greg Kroah-Hartman   Driver core: move...
94
  extern int device_private_init(struct device *dev);
c6f7e72a3   Greg Kroah-Hartman   driver core: remo...
95
  /* initialisation functions */
a1bdc7aad   Ben Dooks   [PATCH] drivers/b...
96
97
98
99
  extern int devices_init(void);
  extern int buses_init(void);
  extern int classes_init(void);
  extern int firmware_init(void);
4039483fd   Michael Holzheu   [PATCH] Driver Co...
100
101
102
103
104
  #ifdef CONFIG_SYS_HYPERVISOR
  extern int hypervisor_init(void);
  #else
  static inline int hypervisor_init(void) { return 0; }
  #endif
a1bdc7aad   Ben Dooks   [PATCH] drivers/b...
105
106
107
  extern int platform_bus_init(void);
  extern int system_bus_init(void);
  extern int cpu_dev_init(void);
a1bdc7aad   Ben Dooks   [PATCH] drivers/b...
108

4a3ad20cc   Greg Kroah-Hartman   Driver core: codi...
109
  extern int bus_add_device(struct device *dev);
2023c610d   Alan Stern   Driver core: add ...
110
  extern void bus_probe_device(struct device *dev);
4a3ad20cc   Greg Kroah-Hartman   Driver core: codi...
111
  extern void bus_remove_device(struct device *dev);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
112

4a3ad20cc   Greg Kroah-Hartman   Driver core: codi...
113
114
  extern int bus_add_driver(struct device_driver *drv);
  extern void bus_remove_driver(struct device_driver *drv);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
115

4a3ad20cc   Greg Kroah-Hartman   Driver core: codi...
116
117
  extern void driver_detach(struct device_driver *drv);
  extern int driver_probe_device(struct device_driver *drv, struct device *dev);
49b420a13   Ming Lei   driver core: chec...
118
119
120
  static inline int driver_match_device(struct device_driver *drv,
  				      struct device *dev)
  {
5247aecfe   Ming Lei   driver core: fix ...
121
  	return drv->bus->match ? drv->bus->match(dev, drv) : 1;
49b420a13   Ming Lei   driver core: chec...
122
  }
07e4a3e27   Patrick Mochel   [PATCH] Move devi...
123

f67d115fe   Adrian Bunk   [PATCH] drivers/b...
124
  extern void sysdev_shutdown(void);
f67d115fe   Adrian Bunk   [PATCH] drivers/b...
125

aa49b9136   Greg Kroah-Hartman   [PATCH] Driver co...
126
  extern char *make_class_name(const char *name, struct kobject *kobj);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
127

2a0134554   Adrian Bunk   Driver core: fix ...
128
  extern int devres_release_all(struct device *dev);
823bccfc4   Greg Kroah-Hartman   remove "struct su...
129

881c6cfd7   Greg Kroah-Hartman   kset: convert /sy...
130
  extern struct kset *devices_kset;
c63469a39   Greg Kroah-Hartman   Driver core: move...
131

92b421416   Randy Dunlap   driver core: fix ...
132
  #if defined(CONFIG_MODULES) && defined(CONFIG_SYSFS)
c63469a39   Greg Kroah-Hartman   Driver core: move...
133
134
135
136
137
138
139
  extern void module_add_driver(struct module *mod, struct device_driver *drv);
  extern void module_remove_driver(struct device_driver *drv);
  #else
  static inline void module_add_driver(struct module *mod,
  				     struct device_driver *drv) { }
  static inline void module_remove_driver(struct device_driver *drv) { }
  #endif
2b2af54a5   Kay Sievers   Driver Core: devt...
140
141
142
143
144
145
  
  #ifdef CONFIG_DEVTMPFS
  extern int devtmpfs_init(void);
  #else
  static inline int devtmpfs_init(void) { return 0; }
  #endif