drivers/base/base.h
Source file repositories/reference/linux-study-clean/drivers/base/base.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/base/base.h- Extension
.h- Size
- 11259 bytes
- Lines
- 327
- Domain
- Driver Families
- Bucket
- drivers/base
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/notifier.h
Detected Declarations
struct subsys_privatestruct driver_privatestruct device_privatestruct devres_nodestruct devres_nodefunction subsys_putfunction hypervisor_initfunction auxiliary_bus_initfunction driver_match_devicefunction dev_has_sync_statefunction dev_sync_statefunction device_set_driverfunction module_add_driverfunction module_remove_driverfunction devtmpfs_initfunction is_blockdevfunction is_blockdevfunction devtmpfs_create_nodefunction devtmpfs_delete_nodefunction pinctrl_bind_pins
Annotated Snippet
* @bus: pointer back to the struct bus_type that this structure is associated
* with.
* @dev_root: Default device to use as the parent.
* @glue_dirs: "glue" directory to put in-between the parent device to
* avoid namespace conflicts
* @class: pointer back to the struct class that this structure is associated
* with.
* @lock_key: Lock class key for use by the lock validator
*
* This structure is the one that is the actual kobject allowing struct
* bus_type/class to be statically allocated safely. Nothing outside of the
* driver core should ever touch these fields.
*/
struct subsys_private {
struct kset subsys;
struct kset *devices_kset;
struct list_head interfaces;
struct mutex mutex;
struct kset *drivers_kset;
struct klist klist_devices;
struct klist klist_drivers;
struct blocking_notifier_head bus_notifier;
unsigned int drivers_autoprobe:1;
const struct bus_type *bus;
struct device *dev_root;
struct kset glue_dirs;
const struct class *class;
struct lock_class_key lock_key;
};
#define to_subsys_private(obj) container_of_const(obj, struct subsys_private, subsys.kobj)
static inline struct subsys_private *subsys_get(struct subsys_private *sp)
{
if (sp)
kset_get(&sp->subsys);
return sp;
}
static inline void subsys_put(struct subsys_private *sp)
{
if (sp)
kset_put(&sp->subsys);
}
struct subsys_private *bus_to_subsys(const struct bus_type *bus);
struct subsys_private *class_to_subsys(const struct class *class);
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)
/**
* struct device_private - structure to hold the private to the driver core
* portions of the device structure.
* @klist_children: klist containing all children of this device
* @knode_parent: node in sibling list
* @knode_driver: node in driver list
* @knode_bus: node in bus list
* @knode_class: node in class list
* @deferred_probe: entry in deferred_probe_list which is used to retry the
* binding of drivers which were unable to get all the
* resources needed by the device; typically because it depends
* on another driver getting probed first.
* @async_driver: pointer to device driver awaiting probe via async_probe
* @deferred_probe_reason: capture the -EPROBE_DEFER message emitted with
* dev_err_probe() for later retrieval via debugfs
* @device: pointer back to the struct device that this structure is
* associated with.
* @dead: This device is currently either in the process of or has been
* removed from the system. Any asynchronous events scheduled for this
* device should exit without taking any action.
*
* Nothing outside of the driver core should ever touch these fields.
*/
struct device_private {
struct klist klist_children;
struct klist_node knode_parent;
struct klist_node knode_driver;
struct klist_node knode_bus;
struct klist_node knode_class;
struct list_head deferred_probe;
const struct device_driver *async_driver;
Annotation
- Immediate include surface: `linux/notifier.h`.
- Detected declarations: `struct subsys_private`, `struct driver_private`, `struct device_private`, `struct devres_node`, `struct devres_node`, `function subsys_put`, `function hypervisor_init`, `function auxiliary_bus_init`, `function driver_match_device`, `function dev_has_sync_state`.
- Atlas domain: Driver Families / drivers/base.
- Implementation status: pattern implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.