提交 89c42606 编写于 作者: G Greg Kroah-Hartman

Kobject: change drivers/block/pktcdvd.c to use kobject_init_and_add

Stop using kobject_register, as this way we can control the sending of
the uevent properly, after everything is properly initialized.

Cc: Jens Axboe <axboe@kernel.dk>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 a77aa28a
...@@ -110,17 +110,18 @@ static struct pktcdvd_kobj* pkt_kobj_create(struct pktcdvd_device *pd, ...@@ -110,17 +110,18 @@ static struct pktcdvd_kobj* pkt_kobj_create(struct pktcdvd_device *pd,
struct kobj_type* ktype) struct kobj_type* ktype)
{ {
struct pktcdvd_kobj *p; struct pktcdvd_kobj *p;
int error;
p = kzalloc(sizeof(*p), GFP_KERNEL); p = kzalloc(sizeof(*p), GFP_KERNEL);
if (!p) if (!p)
return NULL; return NULL;
kobject_set_name(&p->kobj, "%s", name);
p->kobj.parent = parent;
p->kobj.ktype = ktype;
p->pd = pd; p->pd = pd;
if (kobject_register(&p->kobj) != 0) { error = kobject_init_and_add(&p->kobj, ktype, parent, "%s", name);
if (error) {
kobject_put(&p->kobj); kobject_put(&p->kobj);
return NULL; return NULL;
} }
kobject_uevent(&p->kobj, KOBJ_ADD);
return p; return p;
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册