摘自:
http://blog.csdn.net/makethyme/article/details/7193782
1. struct device不再包含bus_id,取而代之的是.init_name,修改ldd_bus
-
struct device ldd_bus = {
-
.init_name = "ldd0",
-
.release = ldd_bus_release
-
修改函数register_ldd_device如下:
strncpy(ldddev->dev.bus_id, ldddev->name, BUS_ID_SIZE);
替换为:
ldddev->dev.init_name = ldddev->name;
或
dev_set_name(&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如下:
-
struct bus_type ldd_bus_type = {
-
.name = "ldd",
-
.match = ldd_match,
-
.uevent = ldd_uevent,
-
};
而原来的函数ldd_hotplug用ldd_event来取代如下:
-
static int ldd_uevent(struct device *dev, struct kobj_uevent_env *env) {
-
env->envp[0] = evn->buf;
-
if (snprintf(env->buf, env->buflen, "LDDBUS_VERSION=%s", Version) >= env->buflen)
-
return -ENOMEM;
-
env->envp[1] = NULL;
-
return 0;
-
}
阅读(1316) | 评论(0) | 转发(0) |