aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-11-01 13:39:50 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 23:40:16 -0500
commit7405c1e15edfe43b137bfbc5882f1af34d6d414d (patch)
tree94093ac6ece6e0a33f504e6c7778a2c443dae958
parent081248de0a0288a0ce4e1447a07ccf56aa4fae01 (diff)
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: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--include/linux/module.h4
-rw-r--r--kernel/module.c7
-rw-r--r--kernel/params.c29
3 files changed, 15 insertions, 25 deletions
diff --git a/include/linux/module.h b/include/linux/module.h
index 2cbc0b87e329..fbe930b9b69c 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -574,7 +574,9 @@ struct device_driver;
574#ifdef CONFIG_SYSFS 574#ifdef CONFIG_SYSFS
575struct module; 575struct module;
576 576
577extern struct kset module_subsys; 577extern struct kset *module_kset;
578extern struct kobj_type module_ktype;
579extern int module_sysfs_initialized;
578 580
579int mod_sysfs_init(struct module *mod); 581int mod_sysfs_init(struct module *mod);
580int mod_sysfs_setup(struct module *mod, 582int mod_sysfs_setup(struct module *mod,
diff --git a/kernel/module.c b/kernel/module.c
index 55142775c581..d03fcd9d652c 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -47,8 +47,6 @@
47#include <asm/cacheflush.h> 47#include <asm/cacheflush.h>
48#include <linux/license.h> 48#include <linux/license.h>
49 49
50extern int module_sysfs_initialized;
51
52#if 0 50#if 0
53#define DEBUGP printk 51#define DEBUGP printk
54#else 52#else
@@ -1223,7 +1221,8 @@ int mod_sysfs_init(struct module *mod)
1223 err = kobject_set_name(&mod->mkobj.kobj, "%s", mod->name); 1221 err = kobject_set_name(&mod->mkobj.kobj, "%s", mod->name);
1224 if (err) 1222 if (err)
1225 goto out; 1223 goto out;
1226 mod->mkobj.kobj.kset = &module_subsys; 1224 mod->mkobj.kobj.kset = module_kset;
1225 mod->mkobj.kobj.ktype = &module_ktype;
1227 mod->mkobj.mod = mod; 1226 mod->mkobj.mod = mod;
1228 1227
1229 kobject_init(&mod->mkobj.kobj); 1228 kobject_init(&mod->mkobj.kobj);
@@ -2539,7 +2538,7 @@ void module_add_driver(struct module *mod, struct device_driver *drv)
2539 struct kobject *mkobj; 2538 struct kobject *mkobj;
2540 2539
2541 /* Lookup built-in module entry in /sys/modules */ 2540 /* Lookup built-in module entry in /sys/modules */
2542 mkobj = kset_find_obj(&module_subsys, drv->mod_name); 2541 mkobj = kset_find_obj(module_kset, drv->mod_name);
2543 if (mkobj) { 2542 if (mkobj) {
2544 mk = container_of(mkobj, struct module_kobject, kobj); 2543 mk = container_of(mkobj, struct module_kobject, kobj);
2545 /* remember our module structure */ 2544 /* remember our module structure */
diff --git a/kernel/params.c b/kernel/params.c
index 9f051824097d..97e092312155 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -30,8 +30,6 @@
30#define DEBUGP(fmt, a...) 30#define DEBUGP(fmt, a...)
31#endif 31#endif
32 32
33static struct kobj_type module_ktype;
34
35static inline char dash2underscore(char c) 33static inline char dash2underscore(char c)
36{ 34{
37 if (c == '-') 35 if (c == '-')
@@ -562,7 +560,7 @@ static void __init kernel_param_sysfs_setup(const char *name,
562 BUG_ON(!mk); 560 BUG_ON(!mk);
563 561
564 mk->mod = THIS_MODULE; 562 mk->mod = THIS_MODULE;
565 mk->kobj.kset = &module_subsys; 563 mk->kobj.kset = module_kset;
566 mk->kobj.ktype = &module_ktype; 564 mk->kobj.ktype = &module_ktype;
567 kobject_set_name(&mk->kobj, name); 565 kobject_set_name(&mk->kobj, name);
568 kobject_init(&mk->kobj); 566 kobject_init(&mk->kobj);
@@ -695,7 +693,7 @@ static struct kset_uevent_ops module_uevent_ops = {
695 .filter = uevent_filter, 693 .filter = uevent_filter,
696}; 694};
697 695
698decl_subsys(module, &module_uevent_ops); 696struct kset *module_kset;
699int module_sysfs_initialized; 697int module_sysfs_initialized;
700 698
701static void module_release(struct kobject *kobj) 699static void module_release(struct kobject *kobj)
@@ -707,7 +705,7 @@ static void module_release(struct kobject *kobj)
707 */ 705 */
708} 706}
709 707
710static struct kobj_type module_ktype = { 708struct kobj_type module_ktype = {
711 .sysfs_ops = &module_sysfs_ops, 709 .sysfs_ops = &module_sysfs_ops,
712 .release = module_release, 710 .release = module_release,
713}; 711};
@@ -717,13 +715,11 @@ static struct kobj_type module_ktype = {
717 */ 715 */
718static int __init param_sysfs_init(void) 716static int __init param_sysfs_init(void)
719{ 717{
720 int ret; 718 module_kset = kset_create_and_add("module", &module_uevent_ops, NULL);
721 719 if (!module_kset) {
722 ret = subsystem_register(&module_subsys); 720 printk(KERN_WARNING "%s (%d): error creating kset\n",
723 if (ret < 0) { 721 __FILE__, __LINE__);
724 printk(KERN_WARNING "%s (%d): subsystem_register error: %d\n", 722 return -ENOMEM;
725 __FILE__, __LINE__, ret);
726 return ret;
727 } 723 }
728 module_sysfs_initialized = 1; 724 module_sysfs_initialized = 1;
729 725
@@ -733,14 +729,7 @@ static int __init param_sysfs_init(void)
733} 729}
734subsys_initcall(param_sysfs_init); 730subsys_initcall(param_sysfs_init);
735 731
736#else 732#endif /* CONFIG_SYSFS */
737#if 0
738static struct sysfs_ops module_sysfs_ops = {
739 .show = NULL,
740 .store = NULL,
741};
742#endif
743#endif
744 733
745EXPORT_SYMBOL(param_set_byte); 734EXPORT_SYMBOL(param_set_byte);
746EXPORT_SYMBOL(param_get_byte); 735EXPORT_SYMBOL(param_get_byte);