1STRUCT DEVICE(9)         Device drivers infrastructure        STRUCT DEVICE(9)
2
3
4

NAME

6       struct_device - The basic device structure
7

SYNOPSIS

9       struct device {
10         struct device * parent;
11         struct device_private * p;
12         struct kobject kobj;
13         const char * init_name;
14         const struct device_type * type;
15         struct mutex mutex;
16         struct bus_type * bus;
17         struct device_driver * driver;
18         void * platform_data;
19         struct dev_pm_info power;
20         struct dev_pm_domain * pm_domain;
21       #ifdef CONFIG_NUMA
22         int numa_node;
23       #endif
24         u64 * dma_mask;
25         u64 coherent_dma_mask;
26         struct device_dma_parameters * dma_parms;
27         struct list_head dma_pools;
28         struct dma_coherent_mem * dma_mem;
29       #ifdef CONFIG_DMA_CMA
30       #endif
31         struct dev_archdata archdata;
32         struct device_node * of_node;
33         RH_KABI_DEPRECATE(struct acpi_dev_node# acpi_node)dev_t devt;
34         u32 id;
35         spinlock_t devres_lock;
36         struct list_head devres_head;
37         struct klist_node knode_class;
38         struct class * class;
39         const struct attribute_group ** groups;
40         void (* release) (struct device *dev);
41         bool offline_disabled:1;
42         bool offline:1;
43       };
44

MEMBERS

46       parent
47           The device's “parent” device, the device to which it is attached.
48           In most cases, a parent device is some sort of bus or host
49           controller. If parent is NULL, the device, is a top-level device,
50           which is not usually what you want.
51
52       p
53           Holds the private data of the driver core portions of the device.
54           See the comment of the struct device_private for detail.
55
56       kobj
57           A top-level, abstract class from which other classes are derived.
58
59       init_name
60           Initial name of the device.
61
62       type
63           The type of device. This identifies the device type and carries
64           type-specific information.
65
66       mutex
67           Mutex to synchronize calls to its driver.
68
69       bus
70           Type of bus device is on.
71
72       driver
73           Which driver has allocated this
74
75       platform_data
76           Platform data specific to the device.
77
78       power
79           For device power management. See Documentation/power/devices.txt
80           for details.
81
82       pm_domain
83           Provide callbacks that are executed during system suspend,
84           hibernation, system resume and during runtime PM transitions along
85           with subsystem-level and driver-level callbacks.
86
87       numa_node
88           NUMA node this device is close to.
89
90       dma_mask
91           Dma mask (if dma'ble device).
92
93       coherent_dma_mask
94           Like dma_mask, but for alloc_coherent mapping as not all hardware
95           supports 64-bit addresses for consistent allocations such
96           descriptors.
97
98       dma_parms
99           A low level driver may set these to teach IOMMU code about segment
100           limitations.
101
102       dma_pools
103           Dma pools (if dma'ble device).
104
105       dma_mem
106           Internal for coherent mem override.
107
108       archdata
109           For arch-specific additions.
110
111       of_node
112           Associated device tree node.
113
114       devt
115           For creating the sysfs “dev”.
116
117       id
118           device instance
119
120       devres_lock
121           Spinlock to protect the resource of the device.
122
123       devres_head
124           The resources list of the device.
125
126       knode_class
127           The node used to add the device to the class list.
128
129       class
130           The class of the device.
131
132       groups
133           Optional attribute groups.
134
135       release
136           Callback to free the device after all references have gone away.
137           This should be set by the allocator of the device (i.e. the bus
138           driver that discovered the device).
139
140       offline_disabled
141           If set, the device is permanently online.
142
143       offline
144           Set after successful invocation of bus type's .offline.
145

EXAMPLE

147              For devices on custom boards, as typical of embedded
148                     and SOC based hardware, Linux often uses platform_data to point
149                     to board-specific structures describing devices and how they
150                     are wired.  That can include what ports are available, chip
151                     variants, which GPIO pins act in what additional roles, and so
152                     on.  This shrinks the “Board Support Packages” (BSPs) and
153                     minimizes board-specific #ifdefs in drivers.
154

DESCRIPTION

156       At the lowest level, every device in a Linux system is represented by
157       an instance of struct device. The device structure contains the
158       information that the device model core needs to model the system. Most
159       subsystems, however, track additional information about the devices
160       they host. As a result, it is rare for devices to be represented by
161       bare device structures; instead, that structure, like kobject
162       structures, is usually embedded within a higher-level representation of
163       the device.
164
166Kernel Hackers Manual 3.10         June 2019                  STRUCT DEVICE(9)
Impressum