| .. | .. |
|---|
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
|---|
| 2 | +/* |
|---|
| 3 | + * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org> |
|---|
| 4 | + * Copyright (c) 2004-2009 Greg Kroah-Hartman <gregkh@suse.de> |
|---|
| 5 | + * Copyright (c) 2008-2012 Novell Inc. |
|---|
| 6 | + * Copyright (c) 2012-2019 Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|
| 7 | + * Copyright (c) 2012-2019 Linux Foundation |
|---|
| 8 | + * |
|---|
| 9 | + * Core driver model functions and structures that should not be |
|---|
| 10 | + * shared outside of the drivers/base/ directory. |
|---|
| 11 | + * |
|---|
| 12 | + */ |
|---|
| 2 | 13 | #include <linux/notifier.h> |
|---|
| 3 | 14 | |
|---|
| 4 | 15 | /** |
|---|
| .. | .. |
|---|
| 60 | 71 | * @knode_parent - node in sibling list |
|---|
| 61 | 72 | * @knode_driver - node in driver list |
|---|
| 62 | 73 | * @knode_bus - node in bus list |
|---|
| 74 | + * @knode_class - node in class list |
|---|
| 63 | 75 | * @deferred_probe - entry in deferred_probe_list which is used to retry the |
|---|
| 64 | 76 | * binding of drivers which were unable to get all the resources needed by |
|---|
| 65 | 77 | * the device; typically because it depends on another driver getting |
|---|
| .. | .. |
|---|
| 78 | 90 | struct klist_node knode_parent; |
|---|
| 79 | 91 | struct klist_node knode_driver; |
|---|
| 80 | 92 | struct klist_node knode_bus; |
|---|
| 93 | + struct klist_node knode_class; |
|---|
| 81 | 94 | struct list_head deferred_probe; |
|---|
| 82 | 95 | struct device_driver *async_driver; |
|---|
| 96 | + char *deferred_probe_reason; |
|---|
| 83 | 97 | struct device *device; |
|---|
| 84 | 98 | u8 dead:1; |
|---|
| 85 | 99 | }; |
|---|
| .. | .. |
|---|
| 89 | 103 | container_of(obj, struct device_private, knode_driver) |
|---|
| 90 | 104 | #define to_device_private_bus(obj) \ |
|---|
| 91 | 105 | container_of(obj, struct device_private, knode_bus) |
|---|
| 106 | +#define to_device_private_class(obj) \ |
|---|
| 107 | + container_of(obj, struct device_private, knode_class) |
|---|
| 92 | 108 | |
|---|
| 93 | 109 | /* initialisation functions */ |
|---|
| 94 | 110 | extern int devices_init(void); |
|---|
| .. | .. |
|---|
| 119 | 135 | extern void driver_detach(struct device_driver *drv); |
|---|
| 120 | 136 | extern int driver_probe_device(struct device_driver *drv, struct device *dev); |
|---|
| 121 | 137 | extern void driver_deferred_probe_del(struct device *dev); |
|---|
| 138 | +extern void device_set_deferred_probe_reason(const struct device *dev, |
|---|
| 139 | + struct va_format *vaf); |
|---|
| 122 | 140 | static inline int driver_match_device(struct device_driver *drv, |
|---|
| 123 | 141 | struct device *dev) |
|---|
| 124 | 142 | { |
|---|
| .. | .. |
|---|
| 161 | 179 | /* Device links support */ |
|---|
| 162 | 180 | extern int device_links_read_lock(void); |
|---|
| 163 | 181 | extern void device_links_read_unlock(int idx); |
|---|
| 182 | +extern int device_links_read_lock_held(void); |
|---|
| 164 | 183 | extern int device_links_check_suppliers(struct device *dev); |
|---|
| 165 | 184 | extern void device_links_driver_bound(struct device *dev); |
|---|
| 166 | 185 | extern void device_links_driver_cleanup(struct device *dev); |
|---|
| .. | .. |
|---|
| 170 | 189 | |
|---|
| 171 | 190 | /* device pm support */ |
|---|
| 172 | 191 | void device_pm_move_to_tail(struct device *dev); |
|---|
| 192 | + |
|---|
| 193 | +#ifdef CONFIG_DEVTMPFS |
|---|
| 194 | +int devtmpfs_create_node(struct device *dev); |
|---|
| 195 | +int devtmpfs_delete_node(struct device *dev); |
|---|
| 196 | +#else |
|---|
| 197 | +static inline int devtmpfs_create_node(struct device *dev) { return 0; } |
|---|
| 198 | +static inline int devtmpfs_delete_node(struct device *dev) { return 0; } |
|---|
| 199 | +#endif |
|---|