Kobject: change arch/sh/kernel/cpu/sh4/sq.c to use kobject_init_and_add
authorGreg Kroah-Hartman <gregkh@suse.de>
Mon, 17 Dec 2007 19:54:39 +0000 (15:54 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 25 Jan 2008 04:40:29 +0000 (20:40 -0800)
Stop using kobject_register, as this way we can control the sending of
the uevent properly, after everything is properly initialized.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/sh/kernel/cpu/sh4/sq.c

index b22a78c807e6bb012ba2f4289673176c598e8453..97fd9b9a4820f6746a0db08b1bf388fef2862de5 100644 (file)
@@ -341,17 +341,18 @@ static int __devinit sq_sysdev_add(struct sys_device *sysdev)
 {
        unsigned int cpu = sysdev->id;
        struct kobject *kobj;
+       int error;
 
        sq_kobject[cpu] = kzalloc(sizeof(struct kobject), GFP_KERNEL);
        if (unlikely(!sq_kobject[cpu]))
                return -ENOMEM;
 
        kobj = sq_kobject[cpu];
-       kobj->parent = &sysdev->kobj;
-       kobject_set_name(kobj, "%s", "sq");
-       kobj->ktype = &ktype_percpu_entry;
-
-       return kobject_register(kobj);
+       error = kobject_init_and_add(kobj, &ktype_percpu_entry, &sysdev->kobj,
+                                    "%s", "sq");
+       if (!error)
+               kobject_uevent(kobj, KOBJ_ADD);
+       return error;
 }
 
 static int __devexit sq_sysdev_remove(struct sys_device *sysdev)