Kobject: change drivers/firmware/efivars.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:27 +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/efivars.c

index 7f9f086106cca5e9a8a1e9b3068e56c75a0da22e..b61a72fb6219772f61903cacff484867a55eaa36 100644 (file)
@@ -617,16 +617,16 @@ efivar_create_sysfs_entry(unsigned long variable_name_size,
        *(short_name + strlen(short_name)) = '-';
        efi_guid_unparse(vendor_guid, short_name + strlen(short_name));
 
-       kobject_set_name(&new_efivar->kobj, "%s", short_name);
        new_efivar->kobj.kset = vars_kset;
-       new_efivar->kobj.ktype = &efivar_ktype;
-       i = kobject_register(&new_efivar->kobj);
+       i = kobject_init_and_add(&new_efivar->kobj, &efivar_ktype, NULL,
+                                "%s", short_name);
        if (i) {
                kfree(short_name);
                kfree(new_efivar);
                return 1;
        }
 
+       kobject_uevent(&new_efivar->kobj, KOBJ_ADD);
        kfree(short_name);
        short_name = NULL;