按照老传统,描述功能前,先介绍一下该模块的一些核心数据结构,对bus模块而言,核心数据结构就是struct bus_type,另外,还有一个sub system相关的结构,会一并说明。 2.1 struct bus_type 1:/* inlcude/linux/device.h, line 93 */ 2:structbus_type { 3:constchar*name; 4:constchar*dev_name; 5:structdevic...
一、bus注册过程 bus_type结构体代表一条总线,如下所示: struct bus_type { const char *name; //名称 const char *dev_name; struct device *dev_root; struct device_attribute *dev_attrs; /* use dev_groups instead */ const struct attribute_group **bus_groups; ...
* struct bus_type - The bus type of the device * * @name: The name of the bus. * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id). * @dev_root: Default device to use as the parent. * @dev_attrs: Default attributes of the devices on the bus. ...
struct linux module makefile attributes null 本文测试系统为:Ubuntu 10.10 x86_64 2.6.35-24-generic 上节中,除了简单的框架,我们还看到了一个和总线驱动相关的结构体bus_type 。这个结构体的定义在include/linux/device.h 中。本节先简单介绍结构体中的成员,再对每个成员作详细描述。[cpp]01.s t r...
在Linux设备模型中,Bus(总线)是一类特殊的设备,它是连接处理器和其它设备之间的通道(channel)。为了方便设备模型的实现,内核规定,系统中的每个设备都要连接在一个Bus上,这个Bus可以是一个内部Bus、虚拟Bus或者platform Bus。 内核通过struct bus_type结构抽象Bus,它是在include/linux/device.h中定义的...
内核管理的所有的驱动,都必须包含一个叫struct device_driver成员, //男性描述的硬件,必须包含struct device结构体成员。 //女性 struct device_driver { const char *name; struct bus_type *bus; struct module *owner; const char *mod_name; /* used for built-in modules */ bool suppress_bind_attrs...
structbus_type*bus;//指向设备所在总线的指针 structdevice*parent;//指向父设备的指针 structdevice_driver*driver;//指向设备所使用的驱动程序的指针 conststructattribute_group**groups;//设备的属性组 structdevice_node*of_node;//指向设备树节点的指针 ...
bus_register(注册一个总线到系统中) 代码语言:javascript 代码运行次数:0 运行 AI代码解释 intbus_register(struct bus_type*bus){int retval;struct subsys_private*priv;struct lock_class_key*key=&bus->lock_key;priv=kzalloc(sizeof(struct subsys_private),GFP_KERNEL);//分配subsys_private结构体if(!priv...
linux将设备挂在总线上,对应设备的注册和匹配流程由总线进行管理,在linux内核中,每一个bus,都由struct bus_type来描述: struct bus_type { const char *name; const char *dev_name; struct device *dev_root; ... int (*match)(struct device *dev, struct device_driver *drv); int (*uevent)(struct...
在bus_type和class结构中都有一个指向struct subsys_private的指针,用于保存bus_type和class结构的驱动程序核心部分的私有数据。从命名上似乎不容易理解struct subsys_private,由于bus_type和clsss结构中都有一个struct subsys_private指针,所以可以将subsys_private理解成bus_type和class的上层,包含了bus和class。 struct...