Commit 7405c1e1 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

kset: convert /sys/module to use kset_create

Dynamically create the kset instead of declaring it statically.  We also
rename module_subsys to module_kset to catch all users of the variable.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 081248de
...@@ -574,7 +574,9 @@ struct device_driver; ...@@ -574,7 +574,9 @@ struct device_driver;
#ifdef CONFIG_SYSFS #ifdef CONFIG_SYSFS
struct module; struct module;
extern struct kset module_subsys; extern struct kset *module_kset;
extern struct kobj_type module_ktype;
extern int module_sysfs_initialized;
int mod_sysfs_init(struct module *mod); int mod_sysfs_init(struct module *mod);
int mod_sysfs_setup(struct module *mod, int mod_sysfs_setup(struct module *mod,
......
...@@ -47,8 +47,6 @@ ...@@ -47,8 +47,6 @@
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <linux/license.h> #include <linux/license.h>
extern int module_sysfs_initialized;
#if 0 #if 0
#define DEBUGP printk #define DEBUGP printk
#else #else
...@@ -1223,7 +1221,8 @@ int mod_sysfs_init(struct module *mod) ...@@ -1223,7 +1221,8 @@ int mod_sysfs_init(struct module *mod)
err = kobject_set_name(&mod->mkobj.kobj, "%s", mod->name); err = kobject_set_name(&mod->mkobj.kobj, "%s", mod->name);
if (err) if (err)
goto out; goto out;
mod->mkobj.kobj.kset = &module_subsys; 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); kobject_init(&mod->mkobj.kobj);
...@@ -2539,7 +2538,7 @@ void module_add_driver(struct module *mod, struct device_driver *drv) ...@@ -2539,7 +2538,7 @@ void module_add_driver(struct module *mod, struct device_driver *drv)
struct kobject *mkobj; struct kobject *mkobj;
/* Lookup built-in module entry in /sys/modules */ /* Lookup built-in module entry in /sys/modules */
mkobj = kset_find_obj(&module_subsys, drv->mod_name); mkobj = kset_find_obj(module_kset, drv->mod_name);
if (mkobj) { if (mkobj) {
mk = container_of(mkobj, struct module_kobject, kobj); mk = container_of(mkobj, struct module_kobject, kobj);
/* remember our module structure */ /* remember our module structure */
......
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
#define DEBUGP(fmt, a...) #define DEBUGP(fmt, a...)
#endif #endif
static struct kobj_type module_ktype;
static inline char dash2underscore(char c) static inline char dash2underscore(char c)
{ {
if (c == '-') if (c == '-')
...@@ -562,7 +560,7 @@ static void __init kernel_param_sysfs_setup(const char *name, ...@@ -562,7 +560,7 @@ static void __init kernel_param_sysfs_setup(const char *name,
BUG_ON(!mk); BUG_ON(!mk);
mk->mod = THIS_MODULE; mk->mod = THIS_MODULE;
mk->kobj.kset = &module_subsys; mk->kobj.kset = module_kset;
mk->kobj.ktype = &module_ktype; mk->kobj.ktype = &module_ktype;
kobject_set_name(&mk->kobj, name); kobject_set_name(&mk->kobj, name);
kobject_init(&mk->kobj); kobject_init(&mk->kobj);
...@@ -695,7 +693,7 @@ static struct kset_uevent_ops module_uevent_ops = { ...@@ -695,7 +693,7 @@ static struct kset_uevent_ops module_uevent_ops = {
.filter = uevent_filter, .filter = uevent_filter,
}; };
decl_subsys(module, &module_uevent_ops); struct kset *module_kset;
int module_sysfs_initialized; int module_sysfs_initialized;
static void module_release(struct kobject *kobj) static void module_release(struct kobject *kobj)
...@@ -707,7 +705,7 @@ static void module_release(struct kobject *kobj) ...@@ -707,7 +705,7 @@ static void module_release(struct kobject *kobj)
*/ */
} }
static struct kobj_type module_ktype = { struct kobj_type module_ktype = {
.sysfs_ops = &module_sysfs_ops, .sysfs_ops = &module_sysfs_ops,
.release = module_release, .release = module_release,
}; };
...@@ -717,13 +715,11 @@ static struct kobj_type module_ktype = { ...@@ -717,13 +715,11 @@ static struct kobj_type module_ktype = {
*/ */
static int __init param_sysfs_init(void) static int __init param_sysfs_init(void)
{ {
int ret; module_kset = kset_create_and_add("module", &module_uevent_ops, NULL);
if (!module_kset) {
ret = subsystem_register(&module_subsys); printk(KERN_WARNING "%s (%d): error creating kset\n",
if (ret < 0) { __FILE__, __LINE__);
printk(KERN_WARNING "%s (%d): subsystem_register error: %d\n", return -ENOMEM;
__FILE__, __LINE__, ret);
return ret;
} }
module_sysfs_initialized = 1; module_sysfs_initialized = 1;
...@@ -733,14 +729,7 @@ static int __init param_sysfs_init(void) ...@@ -733,14 +729,7 @@ static int __init param_sysfs_init(void)
} }
subsys_initcall(param_sysfs_init); subsys_initcall(param_sysfs_init);
#else #endif /* CONFIG_SYSFS */
#if 0
static struct sysfs_ops module_sysfs_ops = {
.show = NULL,
.store = NULL,
};
#endif
#endif
EXPORT_SYMBOL(param_set_byte); EXPORT_SYMBOL(param_set_byte);
EXPORT_SYMBOL(param_get_byte); EXPORT_SYMBOL(param_get_byte);
......
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