diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-11-01 13:39:50 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-24 23:40:16 -0500 |
commit | 7405c1e15edfe43b137bfbc5882f1af34d6d414d (patch) | |
tree | 94093ac6ece6e0a33f504e6c7778a2c443dae958 /kernel/params.c | |
parent | 081248de0a0288a0ce4e1447a07ccf56aa4fae01 (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>
Diffstat (limited to 'kernel/params.c')
-rw-r--r-- | kernel/params.c | 29 |
1 files changed, 9 insertions, 20 deletions
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 | ||
33 | static struct kobj_type module_ktype; | ||
34 | |||
35 | static inline char dash2underscore(char c) | 33 | static 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 | ||
698 | decl_subsys(module, &module_uevent_ops); | 696 | struct kset *module_kset; |
699 | int module_sysfs_initialized; | 697 | int module_sysfs_initialized; |
700 | 698 | ||
701 | static void module_release(struct kobject *kobj) | 699 | static void module_release(struct kobject *kobj) |
@@ -707,7 +705,7 @@ static void module_release(struct kobject *kobj) | |||
707 | */ | 705 | */ |
708 | } | 706 | } |
709 | 707 | ||
710 | static struct kobj_type module_ktype = { | 708 | struct 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 | */ |
718 | static int __init param_sysfs_init(void) | 716 | static 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 | } |
734 | subsys_initcall(param_sysfs_init); | 730 | subsys_initcall(param_sysfs_init); |
735 | 731 | ||
736 | #else | 732 | #endif /* CONFIG_SYSFS */ |
737 | #if 0 | ||
738 | static struct sysfs_ops module_sysfs_ops = { | ||
739 | .show = NULL, | ||
740 | .store = NULL, | ||
741 | }; | ||
742 | #endif | ||
743 | #endif | ||
744 | 733 | ||
745 | EXPORT_SYMBOL(param_set_byte); | 734 | EXPORT_SYMBOL(param_set_byte); |
746 | EXPORT_SYMBOL(param_get_byte); | 735 | EXPORT_SYMBOL(param_get_byte); |