1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>struct bus_type</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Device Drivers"><link rel="up" href="devdrivers.html#idp1109043876" title="The Basic Device Driver-Model Structures"><link rel="prev" href="devdrivers.html" title="Chapter&#160;2.&#160;Device drivers infrastructure"><link rel="next" href="API-struct-device-driver.html" title="struct device_driver"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">struct bus_type</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="devdrivers.html">Prev</a>&#160;</td><th width="60%" align="center">The Basic Device Driver-Model Structures </th><td width="20%" align="right">&#160;<a accesskey="n" href="API-struct-device-driver.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-struct-bus-type"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct bus_type &#8212; 
2  The bus type of the device
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="programlisting">
4struct bus_type {
5  const char * name;
6  const char * dev_name;
7  struct device * dev_root;
8  struct device_attribute * dev_attrs;
9  const struct attribute_group ** bus_groups;
10  const struct attribute_group ** dev_groups;
11  const struct attribute_group ** drv_groups;
12  int (* match) (struct device *dev, struct device_driver *drv);
13  int (* uevent) (struct device *dev, struct kobj_uevent_env *env);
14  int (* probe) (struct device *dev);
15  int (* remove) (struct device *dev);
16  void (* shutdown) (struct device *dev);
17  int (* online) (struct device *dev);
18  int (* offline) (struct device *dev);
19  int (* suspend) (struct device *dev, pm_message_t state);
20  int (* resume) (struct device *dev);
21  const struct dev_pm_ops * pm;
22  const struct iommu_ops * iommu_ops;
23  struct subsys_private * p;
24  struct lock_class_key lock_key;
25};  </pre></div><div class="refsect1"><a name="idp1109048924"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">name</span></dt><dd><p>
26The name of the bus.
27      </p></dd><dt><span class="term">dev_name</span></dt><dd><p>
28Used for subsystems to enumerate devices like ("foo<code class="constant">u</code>", dev-&gt;id).
29      </p></dd><dt><span class="term">dev_root</span></dt><dd><p>
30Default device to use as the parent.
31      </p></dd><dt><span class="term">dev_attrs</span></dt><dd><p>
32Default attributes of the devices on the bus.
33      </p></dd><dt><span class="term">bus_groups</span></dt><dd><p>
34Default attributes of the bus.
35      </p></dd><dt><span class="term">dev_groups</span></dt><dd><p>
36Default attributes of the devices on the bus.
37      </p></dd><dt><span class="term">drv_groups</span></dt><dd><p>
38Default attributes of the device drivers on the bus.
39      </p></dd><dt><span class="term">match</span></dt><dd><p>
40Called, perhaps multiple times, whenever a new device or driver
41is added for this bus. It should return a nonzero value if the
42given device can be handled by the given driver.
43      </p></dd><dt><span class="term">uevent</span></dt><dd><p>
44Called when a device is added, removed, or a few other things
45that generate uevents to add the environment variables.
46      </p></dd><dt><span class="term">probe</span></dt><dd><p>
47Called when a new device or driver add to this bus, and callback
48the specific driver's probe to initial the matched device.
49      </p></dd><dt><span class="term">remove</span></dt><dd><p>
50Called when a device removed from this bus.
51      </p></dd><dt><span class="term">shutdown</span></dt><dd><p>
52Called at shut-down time to quiesce the device.
53      </p></dd><dt><span class="term">online</span></dt><dd><p>
54Called to put the device back online (after offlining it).
55      </p></dd><dt><span class="term">offline</span></dt><dd><p>
56Called to put the device offline for hot-removal. May fail.
57      </p></dd><dt><span class="term">suspend</span></dt><dd><p>
58Called when a device on this bus wants to go to sleep mode.
59      </p></dd><dt><span class="term">resume</span></dt><dd><p>
60Called to bring a device on this bus out of sleep mode.
61      </p></dd><dt><span class="term">pm</span></dt><dd><p>
62Power management operations of this bus, callback the specific
63device driver's pm-ops.
64      </p></dd><dt><span class="term">iommu_ops</span></dt><dd><p>
65IOMMU specific operations for this bus, used to attach IOMMU
66driver implementations to a bus and allow the driver to do
67bus-specific setup
68      </p></dd><dt><span class="term">p</span></dt><dd><p>
69The private data of the driver core, only the driver core can
70touch this.
71      </p></dd><dt><span class="term">lock_key</span></dt><dd><p>
72Lock class key for use by the lock validator
73      </p></dd></dl></div></div><div class="refsect1"><a name="idp1109064548"></a><h2>Description</h2><p>
74   A bus is a channel between the processor and one or more devices. For the
75   purposes of the device model, all devices are connected via a bus, even if
76   it is an internal, virtual, <span class="quote">&#8220;<span class="quote">platform</span>&#8221;</span> bus. Buses can plug into each other.
77   A USB controller is usually a PCI device, for example. The device model
78   represents the actual connections between buses and the devices they control.
79   A bus is represented by the bus_type structure. It contains the name, the
80   default attributes, the bus' methods, PM operations, and the driver core's
81   private data.
82</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="devdrivers.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="devdrivers.html#idp1109043876">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-struct-device-driver.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&#160;2.&#160;Device drivers infrastructure&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;<span class="phrase">struct device_driver</span></td></tr></table></div></body></html>
83