Commit ac3c8141 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 649316b2
...@@ -1217,18 +1217,16 @@ int mod_sysfs_init(struct module *mod) ...@@ -1217,18 +1217,16 @@ int mod_sysfs_init(struct module *mod)
err = -EINVAL; err = -EINVAL;
goto out; 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; 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 */ /* delay uevent until full sysfs population */
err = kobject_add(&mod->mkobj.kobj);
out: out:
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment