summaryrefslogtreecommitdiff
path: root/kernel/module.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-12-17 23:05:35 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 20:40:38 -0800
commitac3c8141f62f357169980ec21b7be6d29964a394 (patch)
tree096cd77cecc2bce54978fd565982313382507b79 /kernel/module.c
parent649316b25b148e57c8ef71748fc69fa6db276ad1 (diff)
Kobject: convert kernel/module.c to use kobject_init/add_ng()
This converts the code to use the new kobject functions, cleaning up the logic in doing so. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 0ae811785c5..89cd4c7361d 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1217,18 +1217,16 @@ int mod_sysfs_init(struct module *mod)
err = -EINVAL;
goto out;
}
- memset(&mod->mkobj.kobj, 0, sizeof(mod->mkobj.kobj));
- err = kobject_set_name(&mod->mkobj.kobj, "%s", mod->name);
- if (err)
- goto out;
- mod->mkobj.kobj.kset = module_kset;
- mod->mkobj.kobj.ktype = &module_ktype;
mod->mkobj.mod = mod;
- kobject_init(&mod->mkobj.kobj);
+ memset(&mod->mkobj.kobj, 0, sizeof(mod->mkobj.kobj));
+ mod->mkobj.kobj.kset = module_kset;
+ err = kobject_init_and_add(&mod->mkobj.kobj, &module_ktype, NULL,
+ "%s", mod->name);
+ if (err)
+ kobject_put(&mod->mkobj.kobj);
/* delay uevent until full sysfs population */
- err = kobject_add(&mod->mkobj.kobj);
out:
return err;
}