STRUCT DEVICE(9) | Device drivers infrastructure | STRUCT DEVICE(9) |
NAME¶
struct_device - The basic device structure
SYNOPSIS¶
struct device {
struct device * parent;
struct device_private * p;
struct kobject kobj;
const char * init_name;
const struct device_type * type;
struct mutex mutex;
struct bus_type * bus;
struct device_driver * driver;
void * platform_data;
struct dev_pm_info power;
struct dev_pm_domain * pm_domain; #ifdef CONFIG_NUMA
int numa_node; #endif
u64 * dma_mask;
u64 coherent_dma_mask;
struct device_dma_parameters * dma_parms;
struct list_head dma_pools;
struct dma_coherent_mem * dma_mem; #ifdef CONFIG_DMA_CMA #endif
struct dev_archdata archdata;
struct device_node * of_node;
RH_KABI_DEPRECATE(struct acpi_dev_node# acpi_node)dev_t devt;
u32 id;
spinlock_t devres_lock;
struct list_head devres_head;
struct klist_node knode_class;
struct class * class;
const struct attribute_group ** groups;
void (* release) (struct device *dev);
bool offline_disabled:1;
bool offline:1; };
MEMBERS¶
parent
p
kobj
init_name
type
mutex
bus
driver
platform_data
power
pm_domain
numa_node
dma_mask
coherent_dma_mask
dma_parms
dma_pools
dma_mem
archdata
of_node
devt
id
devres_lock
devres_head
knode_class
class
groups
release
offline_disabled
offline
EXAMPLE¶
For devices on custom boards, as typical of embedded
and SOC based hardware, Linux often uses platform_data to point
to board-specific structures describing devices and how they
are wired. That can include what ports are available, chip
variants, which GPIO pins act in what additional roles, and so
on. This shrinks the “Board Support Packages” (BSPs) and
minimizes board-specific #ifdefs in drivers.
DESCRIPTION¶
At the lowest level, every device in a Linux system is represented by an instance of struct device. The device structure contains the information that the device model core needs to model the system. Most subsystems, however, track additional information about the devices they host. As a result, it is rare for devices to be represented by bare device structures; instead, that structure, like kobject structures, is usually embedded within a higher-level representation of the device.
COPYRIGHT¶
June 2024 | Kernel Hackers Manual 3.10 |