linux2.6.28和linux2.6.3xx内核 的struct device 中,bus_id的改变
来源:互联网 发布:淘宝网 玄关 编辑:程序博客网 时间:2024/06/06 18:03
按照国嵌的代码(LDD那本书上的代码也一样):
struct device my_bus = {
.bus_id = "my_bus0",
.release = my_bus_release,
};
static int my_match(struct device *dev, struct device_driver *driver)
{
return !strncmp(dev->bus_id, driver->name, strlen(driver->name));
}
编译时,提示 struct device 中没有bus_id 这样的错误。打开/lib/modules/2.6.35-28-generic/build/include/linux/device.h
找到struct device 的定义,里面没有bus_id,但有:
const char *init_name; /* initial name of the device */ 这句。
可见,要把上面结构中的.bus_id = "my_bus0", 改为 .init_name = "my_bus0",
同时上网搜到,return !strncmp(dev->bus_id, driver->name, strlen(driver->name));这句也要改成:
return !strncmp(dev_name(dev), driver->name, strlen(driver->name));
这样编译即可成功!
另注:
如果要设置设备的名字,也不再使用strncpy(my_dev.bus_id, "my_dev", BUS_ID_SIZE); 而改用:
dev_set_name(&dev, "name");
- linux2.6.28和linux2.6.3xx内核 的struct device 中,bus_id的改变
- [S3C6410]Linux2.6.28到Linux2.6.32的内核移植
- 总线设备驱动框架程序 及 struct device中消失的bus_id的取代方法
- 总线设备驱动框架程序 及 struct device中消失的bus_id的取代方法
- struct device的成员变量bus_id到哪里去了?
- linux2.4.37内核的安装
- linux2.6 内核的 initrd
- LINUX2.6 内核API 改变
- linux2.6内核中如何添加新的文件系统
- Linux2.6内核中基于platform机制的驱动模型
- 在linux2.6内核中加入自己的驱动
- Linux2.6内核--中断线被关闭的情况
- Linux2.6内核--中断线被关闭的情况
- linux2.6.xx内核代码分析
- linux2.6.xx内核代码分析
- 从串口驱动的移植看linux2.6内核中的驱动模型 platform device & platform driver
- Linux2.6.29内核的get_user_pages的改进
- linux2.6.28内核对页面置换算法的改进--理论
- Qt的4个图像类QImage/QPixmap/QBitmap/QPicture
- APP Store ,app , IMS, MSRP Server
- 小记一下JSP的维护
- Linux上升级Oracle RAC 10g 到 Oracle RAC 11g
- s3c2440 -gpio
- linux2.6.28和linux2.6.3xx内核 的struct device 中,bus_id的改变
- Android 安装apk文件及相关命令
- 数据库日常维护常用的脚本部分收录
- 用Android访问本地站点
- 让你的电脑不安framework也能运行.net程序
- 跨库操作SQL Server数据库的插入、修改
- delphi7 手动安装 indy10.2.3
- 指向类非static的数据成员和函数的指针用法
- PL/PgSQL基本语句