kobject: convert configfs to use kobject_create

We don't need a kset here, a simple kobject will do just fine, so
dynamically create the kobject and use it.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Greg Kroah-Hartman 2007-10-29 20:13:17 +01:00
parent 191e186bd0
commit 3794491d0c

View file

@ -128,7 +128,7 @@ void configfs_release_fs(void)
} }
static decl_subsys(config, NULL); static struct kobject *config_kobj;
static int __init configfs_init(void) static int __init configfs_init(void)
{ {
@ -140,9 +140,8 @@ static int __init configfs_init(void)
if (!configfs_dir_cachep) if (!configfs_dir_cachep)
goto out; goto out;
config_subsys.kobj.kset = &kernel_subsys; config_kobj = kobject_create_and_add("config", &kernel_subsys.kobj);
err = subsystem_register(&config_subsys); if (!config_kobj) {
if (err) {
kmem_cache_destroy(configfs_dir_cachep); kmem_cache_destroy(configfs_dir_cachep);
configfs_dir_cachep = NULL; configfs_dir_cachep = NULL;
goto out; goto out;
@ -151,7 +150,7 @@ static int __init configfs_init(void)
err = register_filesystem(&configfs_fs_type); err = register_filesystem(&configfs_fs_type);
if (err) { if (err) {
printk(KERN_ERR "configfs: Unable to register filesystem!\n"); printk(KERN_ERR "configfs: Unable to register filesystem!\n");
subsystem_unregister(&config_subsys); kobject_unregister(config_kobj);
kmem_cache_destroy(configfs_dir_cachep); kmem_cache_destroy(configfs_dir_cachep);
configfs_dir_cachep = NULL; configfs_dir_cachep = NULL;
goto out; goto out;
@ -160,7 +159,7 @@ static int __init configfs_init(void)
err = configfs_inode_init(); err = configfs_inode_init();
if (err) { if (err) {
unregister_filesystem(&configfs_fs_type); unregister_filesystem(&configfs_fs_type);
subsystem_unregister(&config_subsys); kobject_unregister(config_kobj);
kmem_cache_destroy(configfs_dir_cachep); kmem_cache_destroy(configfs_dir_cachep);
configfs_dir_cachep = NULL; configfs_dir_cachep = NULL;
} }
@ -171,7 +170,7 @@ out:
static void __exit configfs_exit(void) static void __exit configfs_exit(void)
{ {
unregister_filesystem(&configfs_fs_type); unregister_filesystem(&configfs_fs_type);
subsystem_unregister(&config_subsys); kobject_unregister(config_kobj);
kmem_cache_destroy(configfs_dir_cachep); kmem_cache_destroy(configfs_dir_cachep);
configfs_dir_cachep = NULL; configfs_dir_cachep = NULL;
configfs_inode_exit(); configfs_inode_exit();