struct bus_type结构体描述了linux中的各种bus,比如spi bus,i2c bus,platform bus等等,可以看到,在i2c_bus_type中,定义了match(),probe(),remove()和shutdown()函数,match()函数就是当有新的i2c_client或者i2c_driver添加进来时,试图寻找与新设备匹配的项,返回匹配的结果。 remove()和shutdown(),顾名思义,...
* it is an internal, virtual, "platform" bus. Buses can plug into each other. * A USB controller is usually a PCI device, for example. The device model * represents the actual connections between buses and the devices they control. * A bus is represented by the bus_type structure. It...
上节中,除了简单的框架,我们还看到了一个和总线驱动相关的结构体bus_type 。这个结构体的定义在include/linux/device.h 中。本节先简单介绍结构体中的成员,再对每个成员作详细描述。[cpp]01.s t r u c t b u s _t y p e { 02.c o n s t c h a r *n a m e ; 03.s t ...
每个phy 芯片会创建一个 struct phy_device 类型的设备,对应的有 struct phy_driver 类型的驱动,这两者实际上是挂载在 mdio_bus_type 总线上的,mac 会被注册成 struct net_device。 phy_devicestructphy_device{ structphy_driver*drv;// PHY设备驱动 structmii_bus*bus;// 对应的MII总线 structdevicedev;//...
1 struct bus_type { 2 char * name; 3 4 struct subsystem subsys; 5 struct kset drivers; 6 struct kset devices; 7 8 struct bus_attribute * bus_attrs; 9
pdev->dev.parent = &platform_bus; pdev->dev.bus = &platform_bus_type;switch(pdev->id) {default: dev_set_name(&pdev->dev,"%s.%d", pdev->name, pdev->id);break;casePLATFORM_DEVID_NONE: dev_set_name(&pdev->dev,"%s", pdev->name);break;casePLATFORM_DEVID_AUTO:/** Automatic...
* @bus: Type of bus device is on. * @driver: Which driver has allocated this * @platform_data: Platform data specific to the device. * Example: For devices on custom boards, as typical of embedded * and SOC based hardware, Linux often uses platform_data to point ...
extern struct bus_type ac97_bus_type; extern const struct bus_type ac97_bus_type; /* AC97 platform_data adding function */ static inline void snd_ac97_dev_add_pdata(struct snd_ac97 *ac97, void *data) 2 changes: 1 addition & 1 deletion 2 include/sound/hdaudio.h Original file line...
设备用platform_device表示,驱动用platform_driver进行注册。 与传统的bus/device/driver机制相比,platform由内核进行统一管理,在驱动中使用资源,提高了代码的安全性和可移植性。 二、platform1. platform总线两个最重要的结构体 platform维护的所有的驱动都必须要用该结构体定义: ...
int bus_register(struct bus_type * bus) 调用可能失败, 所以必须始终检查返回值。若成功,新的总线子系统将被添加进系统,并可在 sysfs 的 /sys/bus 下看到。之后可以向总线添加设备。 例如: ret = bus_register(&ldd_bus_type); if (ret) return ret; ...