总线的结构体
/**
* struct bus_type - The bus type of the device
*
* @name: 总线的名称
* @dev_name: ("foo%u", dev->id).用于枚举设备如("foo%u", dev->id)
* @dev_root: 用于父设备的默认设备
* @bus_attrs: bus的缺省属性
* @dev_attrs: bus总线上的设备的缺省属性
* @drv_attrs: bus总线上的设备驱动缺省属性
* @match:在很多时刻都可能被调用,无论是设备还是驱动被添加到bus总线上的
时候。当一个设备能被给的驱动处理的时候它应该返回一个非0值
* @uevent:当一个设备被添加或者移除的时候,或者其他类别的事件像:
未知事件添加到环境变量中
* @probe: 当一个设备或者驱动添加到这个总线的时候调用,并且在驱动探测到
符合它的设备时被回调
* @remove: 当设备从总线移除时调用
* @shutdown: 当关闭电源停止设备的时候调用
* @suspend: 当总线上的设备想进入休眠状态的时候调用
* @resume: 当总线上的设备想退出休眠的状态时调用
* @pm: 总线的电源管理操作,会回调具体设备和驱动的pm操作
* @iommu_ops: 总线的IOMMU具体操作,常常用来绑定IOMMU驱动到总线并且能使
驱动做具体总线配置
* @p: 驱动核心的私有数据,只有驱动核心能操作此数据
bus总线是处理器和一个或许更多设备的通道, 为了设备模型,所有的设备都基于总线
连接,甚至它是一个内部,虚拟或者“platform”总线。总线可以彼此嵌入。例如,一个USB控制器
常常是一个PCI设备。设备模型代表了实际的总线和它们控制的设备之间的连接。一个bus
总线用bus_type结构体代表,它包含名字,默认属性,总线模型,电源操作,和驱动核心
私有数据。
*/
struct bus_type {
const char *name;
const char *dev_name;
struct device *dev_root;
struct bus_attribute *bus_attrs;
struct device_attribute *dev_attrs;
struct driver_attribute *drv_attrs;
int (*match)(struct device *dev, struct device_driver *drv);
int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
int (*probe)(struct device *dev);
int (*remove)(struct device *dev);
void (*shutdown)(struct device *dev);
int (*suspend)(struct device *dev, pm_message_t state);
int (*resume)(struct device *dev);
const struct dev_pm_ops *pm;
struct iommu_ops *iommu_ops;
struct subsys_private *p;
};