数据结构struct bus_type

本文深入探讨了Linux内核中bus_type结构的作用与组成。bus_type结构定义了总线类型的基本属性,包括设备、设备驱动和总线自身的默认属性,以及一系列关键操作函数如match、uevent、probe、remove等,用于设备与驱动的匹配、环境变量更新、设备初始化和移除。同时,还介绍了电源管理、IOMMU操作和私有数据字段。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

struct bus_type {
const char *name;
struct bus_attribute *bus_attrs; // bus总线的默认属性
struct device_attribute * dev_attrs; // bus总线上设备的默认属性
struct driver_attribute *drv_attrs; // bus总线上设备驱动的默认属性
int (*match) (struct device *dev, struct device_driver *drv); // 当有新的设备或驱动添加到总线上时match函数被调用,如果设备和驱
//动可以匹配,返回0;
int (*uevent) (struct device *dev, struct kobj_uevent_env *env); //当一个设备添加、移除或添加环境变量时,函数调用;
int (*probe) (struct device *dev); // 当有新设备或驱动添加时,probe函数调用,并且回调该驱动的probe函数来初始化相关联的设备
int (*remove) (struct device *dev); // 设备移除时调用remove函数
int (*shutdown) (struct device *dev); // Called at shut-down time to quiesce the device.
int (*suspend) (struct device *dev, pm_message_t state); // 设备进入睡眠时调用suspend函数
int (*resume) (struct device *dev); // 唤醒设备时调用resume
const struct dev_pm_ops *pm; // 总线的电源管理选项,并回调设备驱动的电源管理模块
struct iommu_ops *iommu_ops; //
struct subsys_private *p;

};

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值