Commit 89c42606 authored by Greg Kroah-Hartman's avatar 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: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment