Linux设备模型中三个很重要的概念就是总线、设备和驱动,即bus,device和driver。它们分别对应的数据结构分别为struct bus_type,struct device和struct device_driver。
device结构体:
struct device {
struct device *parent;
struct device_private *p;
struct kobject kobj;
struct device_type;
struct device_driver *driver;
struct class *class;
dev_t devt;
};
操作函数
注册:int device_register(struct device *dev)
注销:void device_unregister(struct device *dev)
创建并注册:struct device *device_creat()
驱动device:
struct device_driver{