aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/params.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/params.c')
-rw-r--r--kernel/params.c44
1 files changed, 11 insertions, 33 deletions
diff --git a/kernel/params.c b/kernel/params.c
index dfef46474e55..67f65ee7211d 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -560,11 +560,10 @@ static void __init kernel_param_sysfs_setup(const char *name,
560 BUG_ON(!mk); 560 BUG_ON(!mk);
561 561
562 mk->mod = THIS_MODULE; 562 mk->mod = THIS_MODULE;
563 kobj_set_kset_s(mk, module_subsys); 563 mk->kobj.kset = module_kset;
564 kobject_set_name(&mk->kobj, name); 564 ret = kobject_init_and_add(&mk->kobj, &module_ktype, NULL, "%s", name);
565 kobject_init(&mk->kobj);
566 ret = kobject_add(&mk->kobj);
567 if (ret) { 565 if (ret) {
566 kobject_put(&mk->kobj);
568 printk(KERN_ERR "Module '%s' failed to be added to sysfs, " 567 printk(KERN_ERR "Module '%s' failed to be added to sysfs, "
569 "error number %d\n", name, ret); 568 "error number %d\n", name, ret);
570 printk(KERN_ERR "The system will be unstable now.\n"); 569 printk(KERN_ERR "The system will be unstable now.\n");
@@ -679,8 +678,6 @@ static struct sysfs_ops module_sysfs_ops = {
679 .store = module_attr_store, 678 .store = module_attr_store,
680}; 679};
681 680
682static struct kobj_type module_ktype;
683
684static int uevent_filter(struct kset *kset, struct kobject *kobj) 681static int uevent_filter(struct kset *kset, struct kobject *kobj)
685{ 682{
686 struct kobj_type *ktype = get_ktype(kobj); 683 struct kobj_type *ktype = get_ktype(kobj);
@@ -694,21 +691,11 @@ static struct kset_uevent_ops module_uevent_ops = {
694 .filter = uevent_filter, 691 .filter = uevent_filter,
695}; 692};
696 693
697decl_subsys(module, &module_ktype, &module_uevent_ops); 694struct kset *module_kset;
698int module_sysfs_initialized; 695int module_sysfs_initialized;
699 696
700static void module_release(struct kobject *kobj) 697struct kobj_type module_ktype = {
701{
702 /*
703 * Stupid empty release function to allow the memory for the kobject to
704 * be properly cleaned up. This will not need to be present for 2.6.25
705 * with the upcoming kobject core rework.
706 */
707}
708
709static struct kobj_type module_ktype = {
710 .sysfs_ops = &module_sysfs_ops, 698 .sysfs_ops = &module_sysfs_ops,
711 .release = module_release,
712}; 699};
713 700
714/* 701/*
@@ -716,13 +703,11 @@ static struct kobj_type module_ktype = {
716 */ 703 */
717static int __init param_sysfs_init(void) 704static int __init param_sysfs_init(void)
718{ 705{
719 int ret; 706 module_kset = kset_create_and_add("module", &module_uevent_ops, NULL);
720 707 if (!module_kset) {
721 ret = subsystem_register(&module_subsys); 708 printk(KERN_WARNING "%s (%d): error creating kset\n",
722 if (ret < 0) { 709 __FILE__, __LINE__);
723 printk(KERN_WARNING "%s (%d): subsystem_register error: %d\n", 710 return -ENOMEM;
724 __FILE__, __LINE__, ret);
725 return ret;
726 } 711 }
727 module_sysfs_initialized = 1; 712 module_sysfs_initialized = 1;
728 713
@@ -732,14 +717,7 @@ static int __init param_sysfs_init(void)
732} 717}
733subsys_initcall(param_sysfs_init); 718subsys_initcall(param_sysfs_init);
734 719
735#else 720#endif /* CONFIG_SYSFS */
736#if 0
737static struct sysfs_ops module_sysfs_ops = {
738 .show = NULL,
739 .store = NULL,
740};
741#endif
742#endif
743 721
744EXPORT_SYMBOL(param_set_byte); 722EXPORT_SYMBOL(param_set_byte);
745EXPORT_SYMBOL(param_get_byte); 723EXPORT_SYMBOL(param_get_byte);