|
13 | 13 | #include <linux/notifier.h> |
14 | 14 |
|
15 | 15 | /** |
16 | | - * struct subsys_private - structure to hold the private to the driver core portions of the bus_type/class structure. |
17 | | - * |
18 | | - * @subsys - the struct kset that defines this subsystem |
19 | | - * @devices_kset - the subsystem's 'devices' directory |
20 | | - * @interfaces - list of subsystem interfaces associated |
21 | | - * @mutex - protect the devices, and interfaces lists. |
22 | | - * |
23 | | - * @drivers_kset - the list of drivers associated |
24 | | - * @klist_devices - the klist to iterate over the @devices_kset |
25 | | - * @klist_drivers - the klist to iterate over the @drivers_kset |
26 | | - * @bus_notifier - the bus notifier list for anything that cares about things |
27 | | - * on this bus. |
28 | | - * @bus - pointer back to the struct bus_type that this structure is associated |
29 | | - * with. |
| 16 | + * struct subsys_private - structure to hold the private to the driver core |
| 17 | + * portions of the bus_type/class structure. |
| 18 | + * @subsys: the struct kset that defines this subsystem |
| 19 | + * @devices_kset: the subsystem's 'devices' directory |
| 20 | + * @interfaces: list of subsystem interfaces associated |
| 21 | + * @mutex: protect the devices, and interfaces lists. |
| 22 | + * @drivers_kset: the list of drivers associated |
| 23 | + * @klist_devices: the klist to iterate over the @devices_kset |
| 24 | + * @klist_drivers: the klist to iterate over the @drivers_kset |
| 25 | + * @bus_notifier: the bus notifier list for anything that cares about things |
| 26 | + * on this bus. |
| 27 | + * @drivers_autoprobe: gate whether new devices are automatically attached to |
| 28 | + * registered drivers, or new drivers automatically attach |
| 29 | + * to existing devices. |
| 30 | + * @bus: pointer back to the struct bus_type that this structure is associated |
| 31 | + * with. |
30 | 32 | * @dev_root: Default device to use as the parent. |
31 | | - * |
32 | | - * @glue_dirs - "glue" directory to put in-between the parent device to |
33 | | - * avoid namespace conflicts |
34 | | - * @class - pointer back to the struct class that this structure is associated |
35 | | - * with. |
36 | | - * @lock_key: Lock class key for use by the lock validator |
| 33 | + * @glue_dirs: "glue" directory to put in-between the parent device to |
| 34 | + * avoid namespace conflicts |
| 35 | + * @class: pointer back to the struct class that this structure is associated |
| 36 | + * with. |
| 37 | + * @lock_key: Lock class key for use by the lock validator |
37 | 38 | * |
38 | 39 | * This structure is the one that is the actual kobject allowing struct |
39 | 40 | * bus_type/class to be statically allocated safely. Nothing outside of the |
@@ -98,24 +99,26 @@ struct driver_type { |
98 | 99 | #endif |
99 | 100 |
|
100 | 101 | /** |
101 | | - * struct device_private - structure to hold the private to the driver core portions of the device structure. |
102 | | - * |
103 | | - * @klist_children - klist containing all children of this device |
104 | | - * @knode_parent - node in sibling list |
105 | | - * @knode_driver - node in driver list |
106 | | - * @knode_bus - node in bus list |
107 | | - * @knode_class - node in class list |
108 | | - * @deferred_probe - entry in deferred_probe_list which is used to retry the |
109 | | - * binding of drivers which were unable to get all the resources needed by |
110 | | - * the device; typically because it depends on another driver getting |
111 | | - * probed first. |
112 | | - * @async_driver - pointer to device driver awaiting probe via async_probe |
113 | | - * @device - pointer back to the struct device that this structure is |
114 | | - * associated with. |
115 | | - * @driver_type - The type of the bound Rust driver. |
116 | | - * @dead - This device is currently either in the process of or has been |
117 | | - * removed from the system. Any asynchronous events scheduled for this |
118 | | - * device should exit without taking any action. |
| 102 | + * struct device_private - structure to hold the private to the driver core |
| 103 | + * portions of the device structure. |
| 104 | + * @klist_children: klist containing all children of this device |
| 105 | + * @knode_parent: node in sibling list |
| 106 | + * @knode_driver: node in driver list |
| 107 | + * @knode_bus: node in bus list |
| 108 | + * @knode_class: node in class list |
| 109 | + * @deferred_probe: entry in deferred_probe_list which is used to retry the |
| 110 | + * binding of drivers which were unable to get all the |
| 111 | + * resources needed by the device; typically because it depends |
| 112 | + * on another driver getting probed first. |
| 113 | + * @async_driver: pointer to device driver awaiting probe via async_probe |
| 114 | + * @deferred_probe_reason: capture the -EPROBE_DEFER message emitted with |
| 115 | + * dev_err_probe() for later retrieval via debugfs |
| 116 | + * @device: pointer back to the struct device that this structure is |
| 117 | + * associated with. |
| 118 | + * @driver_type: The type of the bound Rust driver. |
| 119 | + * @dead: This device is currently either in the process of or has been |
| 120 | + * removed from the system. Any asynchronous events scheduled for this |
| 121 | + * device should exit without taking any action. |
119 | 122 | * |
120 | 123 | * Nothing outside of the driver core should ever touch these fields. |
121 | 124 | */ |
@@ -213,6 +216,24 @@ static inline void device_set_driver(struct device *dev, const struct device_dri |
213 | 216 | WRITE_ONCE(dev->driver, (struct device_driver *)drv); |
214 | 217 | } |
215 | 218 |
|
| 219 | +struct devres_node; |
| 220 | +typedef void (*dr_node_release_t)(struct device *dev, struct devres_node *node); |
| 221 | +typedef void (*dr_node_free_t)(struct devres_node *node); |
| 222 | + |
| 223 | +struct devres_node { |
| 224 | + struct list_head entry; |
| 225 | + dr_node_release_t release; |
| 226 | + dr_node_free_t free_node; |
| 227 | + const char *name; |
| 228 | + size_t size; |
| 229 | +}; |
| 230 | + |
| 231 | +void devres_node_init(struct devres_node *node, dr_node_release_t release, |
| 232 | + dr_node_free_t free_node); |
| 233 | +void devres_node_add(struct device *dev, struct devres_node *node); |
| 234 | +bool devres_node_remove(struct device *dev, struct devres_node *node); |
| 235 | +void devres_set_node_dbginfo(struct devres_node *node, const char *name, |
| 236 | + size_t size); |
216 | 237 | void devres_for_each_res(struct device *dev, dr_release_t release, |
217 | 238 | dr_match_t match, void *match_data, |
218 | 239 | void (*fn)(struct device *, void *, void *), |
@@ -291,6 +312,7 @@ static inline int devtmpfs_create_node(struct device *dev) { return 0; } |
291 | 312 | static inline int devtmpfs_delete_node(struct device *dev) { return 0; } |
292 | 313 | #endif |
293 | 314 |
|
| 315 | +void software_node_init(void); |
294 | 316 | void software_node_notify(struct device *dev); |
295 | 317 | void software_node_notify_remove(struct device *dev); |
296 | 318 |
|
|
0 commit comments