error: ‘struct device’ has no member named ‘bus_id’

在新版本的内核中struct device 已经没有bus_id成员,取而代之的是通过dev_name和dev_set_name对设备的名字进行操作。

        dev_name和dev_set_name在2.6.35.6内核中的源代码如下:

        static inline const char *dev_name(const struct device *dev)
        {
                /* Use the init name until the kobject becomes available */
                if (dev->init_name)
                        return dev->init_name;

                return kobject_name(&dev->kobj);
        }

        extern int dev_set_name(struct device *dev, const char *name, ...)
                __attribute__((format(printf, 2, 3)));

kernel 邮件列表

中讲了:struct device - replace bus_id with dev_name(),以后只要使用dev->bus_id的时候,改成dev_name(dev)就可以了。

你可能感兴趣的:(error: ‘struct device’ has no member named ‘bus_id’)