Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2599863
  • 博文数量: 333
  • 博客积分: 4817
  • 博客等级: 上校
  • 技术积分: 4413
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-28 10:51
文章分类

全部博文(333)

文章存档

2017年(20)

2016年(57)

2015年(27)

2014年(20)

2013年(21)

2012年(164)

2011年(24)

分类: LINUX

2012-02-21 16:36:59

1. struct device不再包含bus_id,取而代之的是.init_name,修改ldd_bus

  1. struct device ldd_bus = {  
  2.       .init_name = "ldd0",  
  3.       .release = ldd_bus_release  
修改函数register_ldd_device如下:
   将strncpy(ldddev->dev.bus_id, ldddev->name, BUS_ID_SIZE);
替换为:
   ldddev->dev.init_name = ldddev->name;


修改函数ldd_match如下:
   return !(strncmp(dev->bus_id, driver->name, strlen(driver->name));
修改为
   return !strncmp(dev->init_name, driver->name, strlen(driver->name));

2. 结构体struct bus_type已经改变,不再包含hotplug,取而代之的是uevent,故修改
结构体ldd_bus_type如下:

  1. struct bus_type ldd_bus_type = {  
  2.         .name = "ldd",  
  3.         .match = ldd_match,  
  4.         .uevent = ldd_uevent,  
  5. };  
而原来的函数ldd_hotplug用ldd_event来取代如下:

  1. static int ldd_uevent(struct device *dev, struct kobj_uevent_env *env) {  
  2.     env->envp[0] = evn->buf;  
  3.     if (snprintf(env->buf, env->buflen, "LDDBUS_VERSION=%s", Version) >= env->buflen)  
  4.        return -ENOMEM;  
  5.    env->envp[1] = NULL;  
  6.    return 0;  

阅读(1418) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~