mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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 <[email protected]> Cc: Kay Sievers <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
a77aa28a2d
commit
89c4260664
1 changed files with 5 additions and 4 deletions
|
|
@ -110,17 +110,18 @@ static struct pktcdvd_kobj* pkt_kobj_create(struct pktcdvd_device *pd,
|
|||
struct kobj_type* ktype)
|
||||
{
|
||||
struct pktcdvd_kobj *p;
|
||||
int error;
|
||||
|
||||
p = kzalloc(sizeof(*p), GFP_KERNEL);
|
||||
if (!p)
|
||||
return NULL;
|
||||
kobject_set_name(&p->kobj, "%s", name);
|
||||
p->kobj.parent = parent;
|
||||
p->kobj.ktype = ktype;
|
||||
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);
|
||||
return NULL;
|
||||
}
|
||||
kobject_uevent(&p->kobj, KOBJ_ADD);
|
||||
return p;
|
||||
}
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue