From: Greg Kroah-Hartman Date: Tue, 18 Dec 2007 06:05:35 +0000 (-0700) Subject: Kobject: convert kernel/params.c to use kobject_init/add_ng() X-Git-Tag: v2.6.25-rc1~1243^2~63 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e43b9192c59402685bd1f809068dd13aa5931570;p=linux-2.6 Kobject: convert kernel/params.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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/kernel/params.c b/kernel/params.c index 97e0923121..1078b148ca 100644 --- a/kernel/params.c +++ b/kernel/params.c @@ -561,11 +561,9 @@ static void __init kernel_param_sysfs_setup(const char *name, mk->mod = THIS_MODULE; mk->kobj.kset = module_kset; - mk->kobj.ktype = &module_ktype; - kobject_set_name(&mk->kobj, name); - kobject_init(&mk->kobj); - ret = kobject_add(&mk->kobj); + ret = kobject_init_and_add(&mk->kobj, &module_ktype, NULL, "%s", name); if (ret) { + kobject_put(&mk->kobj); printk(KERN_ERR "Module '%s' failed to be added to sysfs, " "error number %d\n", name, ret); printk(KERN_ERR "The system will be unstable now.\n");