1STRUCT BUS_TYPE(9) Device drivers infrastructure STRUCT BUS_TYPE(9)
2
3
4
6 struct_bus_type - The bus type of the device
7
9 struct bus_type {
10 const char * name;
11 const char * dev_name;
12 struct device * dev_root;
13 struct bus_attribute * bus_attrs;
14 struct device_attribute * dev_attrs;
15 struct driver_attribute * drv_attrs;
16 const struct attribute_group ** bus_groups;
17 const struct attribute_group ** dev_groups;
18 const struct attribute_group ** drv_groups;
19 int (* match) (struct device *dev, struct device_driver *drv);
20 int (* uevent) (struct device *dev, struct kobj_uevent_env *env);
21 int (* probe) (struct device *dev);
22 int (* remove) (struct device *dev);
23 void (* shutdown) (struct device *dev);
24 int (* online) (struct device *dev);
25 int (* offline) (struct device *dev);
26 int (* suspend) (struct device *dev, pm_message_t state);
27 int (* resume) (struct device *dev);
28 const struct dev_pm_ops * pm;
29 struct iommu_ops * iommu_ops;
30 struct subsys_private * p;
31 };
32
34 name
35 The name of the bus.
36
37 dev_name
38 Used for subsystems to enumerate devices like (“foou”, dev->id).
39
40 dev_root
41 Default device to use as the parent.
42
43 bus_attrs
44 Default attributes of the bus.
45
46 dev_attrs
47 Default attributes of the devices on the bus.
48
49 drv_attrs
50 Default attributes of the device drivers on the bus.
51
52 bus_groups
53 Default attributes of the bus.
54
55 dev_groups
56 Default attributes of the devices on the bus.
57
58 drv_groups
59 Default attributes of the device drivers on the bus.
60
61 match
62 Called, perhaps multiple times, whenever a new device or driver is
63 added for this bus. It should return a nonzero value if the given
64 device can be handled by the given driver.
65
66 uevent
67 Called when a device is added, removed, or a few other things that
68 generate uevents to add the environment variables.
69
70 probe
71 Called when a new device or driver add to this bus, and callback
72 the specific driver's probe to initial the matched device.
73
74 remove
75 Called when a device removed from this bus.
76
77 shutdown
78 Called at shut-down time to quiesce the device.
79
80 online
81 Called to put the device back online (after offlining it).
82
83 offline
84 Called to put the device offline for hot-removal. May fail.
85
86 suspend
87 Called when a device on this bus wants to go to sleep mode.
88
89 resume
90 Called to bring a device on this bus out of sleep mode.
91
92 pm
93 Power management operations of this bus, callback the specific
94 device driver's pm-ops.
95
96 iommu_ops
97 IOMMU specific operations for this bus, used to attach IOMMU driver
98 implementations to a bus and allow the driver to do bus-specific
99 setup
100
101 p
102 The private data of the driver core, only the driver core can touch
103 this.
104
106 A bus is a channel between the processor and one or more devices. For
107 the purposes of the device model, all devices are connected via a bus,
108 even if it is an internal, virtual, “platform” bus. Buses can plug into
109 each other. A USB controller is usually a PCI device, for example. The
110 device model represents the actual connections between buses and the
111 devices they control. A bus is represented by the bus_type structure.
112 It contains the name, the default attributes, the bus' methods, PM
113 operations, and the driver core's private data.
114
116Kernel Hackers Manual 3.10 June 2019 STRUCT BUS_TYPE(9)