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;
void * driver_data;
struct dev_pm_info power;
struct dev_pm_domain * pm_domain; #ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
struct irq_domain * msi_domain; #endif #ifdef CONFIG_PINCTRL
struct dev_pin_info * pins; #endif #ifdef CONFIG_GENERIC_MSI_IRQ
struct list_head msi_list; #endif #ifdef CONFIG_NUMA
int numa_node; #endif
u64 * dma_mask;
u64 coherent_dma_mask;
unsigned long dma_pfn_offset;
struct device_dma_parameters * dma_parms;
struct list_head dma_pools;
struct dma_coherent_mem * dma_mem; #ifdef CONFIG_DMA_CMA
struct cma * cma_area; #endif
struct dev_archdata archdata;
struct device_node * of_node;
struct fwnode_handle * fwnode;
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);
struct iommu_group * iommu_group;
bool offline_disabled:1;
bool offline:1; };
MEMBERS¶
parent
p
kobj
init_name
type
mutex
bus
driver
platform_data
driver_data
power
pm_domain
msi_domain
pins
msi_list
numa_node
dma_mask
coherent_dma_mask
dma_pfn_offset
dma_parms
dma_pools
dma_mem
cma_area
archdata
of_node
fwnode
devt
id
devres_lock
devres_head
knode_class
class
groups
release
iommu_group
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¶
January 2017 | Kernel Hackers Manual 4.8. |