Kobject: change drivers/firmware/edd.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:26 +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: Matt Domsch <Matt_Domsch@dell.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/firmware/edd.c

index ddcc95793068308f5f3dbdbfef7749d5aa2371ac..dc0b87b135054f59a459de4c9404afcfc8e98699 100644 (file)
@@ -721,13 +721,13 @@ edd_device_register(struct edd_device *edev, int i)
        if (!edev)
                return 1;
        edd_dev_set_info(edev, i);
-       kobject_set_name(&edev->kobj, "int13_dev%02x",
-                        0x80 + i);
        edev->kobj.kset = edd_kset;
-       edev->kobj.ktype = &edd_ktype;
-       error = kobject_register(&edev->kobj);
-       if (!error)
+       error = kobject_init_and_add(&edev->kobj, &edd_ktype, NULL,
+                                    "int13_dev%02x", 0x80 + i);
+       if (!error) {
                edd_populate_dir(edev);
+               kobject_uevent(&edev->kobj, KOBJ_ADD);
+       }
        return error;
 }