WARNING: CPU: 1 PID: 301 at lib/kobject.c:196 kobject_add_internal+0x204/0x320() kobject_add_internal failed for msi_irqs with -EEXIST, don't try to register things with the same name in the same directory. Modules linked in: bnep btusb bluetooth iTCO_wdt iTCO_vendor_support snd_...
October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register >http://pubads.g.doubleclick.net/gampa...
err = kobject_add_internal(&k->kobj); if (err) return err; kobject_uevent(&k->kobj, KOBJ_ADD); return 0; } kset_init进行一些固定的初始化操作,里面没有我们需要关心的内容 kobject_add_internal为重要的一个函数,他对kset里kobj的从属关系进行解析,搭建正确的架构 static int kobject_add_intern...
如果自己创建的kobject中的kset非NULL,那么在初始化接口kobject_init_and_add->kobject_add_internal: static int kobject_add_internal(struct kobject *kobj) { int error = 0; struct kobject *parent; if (!kobj) return -ENOENT; if (!kobj->name || !kobj->name[0]) { WARN(1, "kobject: ...
static void kobject_init_internal(struct kobject *kobj) { if (!kobj) return; kref_init(&kobj->kref); //原子变量初始化 INIT_LIST_HEAD(&kobj->entry); //初始化链表kobj->state_in_sysfs = 0; //没有出现在sys目录中 kobj->state_add_uevent_sent = 0; ...
该函数调用kobject_set_name_vargs解析可变参数并设置kobject.name的值,然后设置kobj->parent,最后通过kobject_add_internal添加kobject kobject_add_internal函数定义于lib/kobject.c,主要作用是设置kobject的父节点、kset并创建kobject在sysfs中的目录
state_initialized,指示该Kobject是否已经初始化,以在Kobject的Init,Put,Add等操作时进行异常校验。 state_in_sysfs,指示该Kobject是否已在sysfs中呈现,以便在自动注销时从sysfs中移除。 state_add_uevent_sent/state_remove_uevent_sent,记录是否已经向用户空间发送ADD uevent,如果有,且没有发送remove uevent,则在自...
returnkobject_add_internal(kobj); } staticintkobject_add_internal(structkobject*kobj) { interror=0; structkobject*parent; if(!kobj) return-ENOENT; if(!kobj->name||!kobj->name[0]){ WARN(1,"kobject:(%p):attemptedtoberegisteredwithempty" "name!\n",kobj); return-EINVAL;
创建添加一个对象时,通常将 kobject 添加到 kset 中,之后 kobject_add_internal 函数会讲解。 include/linux/kobject.h structkset{ structlist_headlist;/* 包含在kset内的所有kobject构成一个双向链表 */ spinlock_tlist_lock; structkobjectkobj;/* 该kset自己的kobject 归属于该kset的所有的kobject的共有...
int kobject_add(struct kobject * kobj) 将kobj对象加入Linux设备层次。挂接该kobject对象到kset的list链中,增加父目录 各级kobject的引用计数,在其 parent指向的目录下创建文件节点,并启动该类型内 核对象的hotplug函数。 int kobject_register(struct kobject * kobj) kobject注册函数。通过调用kobject init()...