include/linux/device.h
Source file repositories/reference/linux-study-clean/include/linux/device.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/device.h- Extension
.h- Size
- 46805 bytes
- Lines
- 1398
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/dev_printk.hlinux/energy_model.hlinux/ioport.hlinux/kobject.hlinux/klist.hlinux/list.hlinux/lockdep.hlinux/compiler.hlinux/types.hlinux/mutex.hlinux/pm.hlinux/atomic.hlinux/uidgid.hlinux/gfp.hlinux/device/bus.hlinux/device/class.hlinux/device/devres.hlinux/device/driver.hlinux/cleanup.hasm/device.hlinux/pm_wakeup.h
Detected Declarations
struct devicestruct device_privatestruct device_driverstruct driver_privatestruct modulestruct subsys_privatestruct device_nodestruct fwnode_handlestruct iommu_groupstruct dev_pin_infostruct dev_iommustruct msi_device_datastruct subsys_interfacestruct device_typestruct device_attributestruct dev_ext_attributestruct device_dma_parametersstruct dev_links_infostruct dev_msi_infostruct device_physical_locationstruct devicestruct device_linkenum device_link_stateenum dl_dev_stateenum device_removableenum device_physical_location_panelenum device_physical_location_vertical_positionenum device_physical_location_horizontal_positionenum struct_device_flagsfunction device_set_driver_overridefunction device_has_driver_overridefunction device_match_driver_overridefunction device_iommu_mappedfunction dev_to_nodefunction set_dev_nodefunction dev_to_nodefunction set_dev_nodefunction dev_set_msi_domainfunction dev_set_drvdatafunction dev_get_uevent_suppressfunction dev_set_uevent_suppressfunction device_is_registeredfunction device_enable_async_suspendfunction device_disable_async_suspendfunction device_async_suspend_enabledfunction device_pm_not_requiredfunction device_set_pm_not_requiredfunction dev_pm_syscore_device
Annotated Snippet
struct device_driver;
struct driver_private;
struct module;
struct subsys_private;
struct device_node;
struct fwnode_handle;
struct iommu_group;
struct dev_pin_info;
struct dev_iommu;
struct msi_device_data;
/**
* struct subsys_interface - interfaces to device functions
* @name: name of the device function
* @subsys: subsystem of the devices to attach to
* @node: the list of functions registered at the subsystem
* @add_dev: device hookup to device function handler
* @remove_dev: device hookup to device function handler
*
* Simple interfaces attached to a subsystem. Multiple interfaces can
* attach to a subsystem and its devices. Unlike drivers, they do not
* exclusively claim or control devices. Interfaces usually represent
* a specific functionality of a subsystem/class of devices.
*/
struct subsys_interface {
const char *name;
const struct bus_type *subsys;
struct list_head node;
int (*add_dev)(struct device *dev, struct subsys_interface *sif);
void (*remove_dev)(struct device *dev, struct subsys_interface *sif);
};
int subsys_interface_register(struct subsys_interface *sif);
void subsys_interface_unregister(struct subsys_interface *sif);
int subsys_system_register(const struct bus_type *subsys,
const struct attribute_group **groups);
int subsys_virtual_register(const struct bus_type *subsys,
const struct attribute_group **groups);
/*
* The type of device, "struct device" is embedded in. A class
* or bus can contain devices of different types
* like "partitions" and "disks", "mouse" and "event".
* This identifies the device type and carries type-specific
* information, equivalent to the kobj_type of a kobject.
* If "name" is specified, the uevent will contain it in
* the DEVTYPE variable.
*/
struct device_type {
const char *name;
const struct attribute_group **groups;
int (*uevent)(const struct device *dev, struct kobj_uevent_env *env);
char *(*devnode)(const struct device *dev, umode_t *mode,
kuid_t *uid, kgid_t *gid);
void (*release)(struct device *dev);
const struct dev_pm_ops *pm;
};
/**
* struct device_attribute - Interface for exporting device attributes.
* @attr: sysfs attribute definition.
* @show: Show handler.
* @store: Store handler.
*/
struct device_attribute {
struct attribute attr;
__SYSFS_FUNCTION_ALTERNATIVE(
ssize_t (*show)(struct device *dev, struct device_attribute *attr,
char *buf);
ssize_t (*show_const)(struct device *dev, const struct device_attribute *attr,
char *buf);
);
__SYSFS_FUNCTION_ALTERNATIVE(
ssize_t (*store)(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count);
ssize_t (*store_const)(struct device *dev, const struct device_attribute *attr,
const char *buf, size_t count);
);
};
/**
* struct dev_ext_attribute - Exported device attribute with extra context.
* @attr: Exported device attribute.
* @var: Pointer to context.
*/
struct dev_ext_attribute {
struct device_attribute attr;
void *var;
Annotation
- Immediate include surface: `linux/dev_printk.h`, `linux/energy_model.h`, `linux/ioport.h`, `linux/kobject.h`, `linux/klist.h`, `linux/list.h`, `linux/lockdep.h`, `linux/compiler.h`.
- Detected declarations: `struct device`, `struct device_private`, `struct device_driver`, `struct driver_private`, `struct module`, `struct subsys_private`, `struct device_node`, `struct fwnode_handle`, `struct iommu_group`, `struct dev_pin_info`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.