aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-12-17 14:54:39 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 23:40:29 -0500
commit89c426066462263c90957c37af29765855516b83 (patch)
tree97a444a887a8f042b5ca4dec08d953d869f77504 /drivers/block
parenta77aa28a2db3d134dd387f0f05cd6b6717fb1d28 (diff)
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: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/pktcdvd.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 17da6999bef0..d1ee38361e0b 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -110,17 +110,18 @@ static struct pktcdvd_kobj* pkt_kobj_create(struct pktcdvd_device *pd,
110 struct kobj_type* ktype) 110 struct kobj_type* ktype)
111{ 111{
112 struct pktcdvd_kobj *p; 112 struct pktcdvd_kobj *p;
113 int error;
114
113 p = kzalloc(sizeof(*p), GFP_KERNEL); 115 p = kzalloc(sizeof(*p), GFP_KERNEL);
114 if (!p) 116 if (!p)
115 return NULL; 117 return NULL;
116 kobject_set_name(&p->kobj, "%s", name);
117 p->kobj.parent = parent;
118 p->kobj.ktype = ktype;
119 p->pd = pd; 118 p->pd = pd;
120 if (kobject_register(&p->kobj) != 0) { 119 error = kobject_init_and_add(&p->kobj, ktype, parent, "%s", name);
120 if (error) {
121 kobject_put(&p->kobj); 121 kobject_put(&p->kobj);
122 return NULL; 122 return NULL;
123 } 123 }
124 kobject_uevent(&p->kobj, KOBJ_ADD);
124 return p; 125 return p;
125} 126}
126/* 127/*