aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/params.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/params.c')
-rw-r--r--kernel/params.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/kernel/params.c b/kernel/params.c
index 718945da8f58..553cf7d6a4be 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -30,6 +30,8 @@
30#define DEBUGP(fmt, a...) 30#define DEBUGP(fmt, a...)
31#endif 31#endif
32 32
33static struct kobj_type module_ktype;
34
33static inline char dash2underscore(char c) 35static inline char dash2underscore(char c)
34{ 36{
35 if (c == '-') 37 if (c == '-')
@@ -561,14 +563,11 @@ static void __init kernel_param_sysfs_setup(const char *name,
561 mk->mod = THIS_MODULE; 563 mk->mod = THIS_MODULE;
562 kobj_set_kset_s(mk, module_subsys); 564 kobj_set_kset_s(mk, module_subsys);
563 kobject_set_name(&mk->kobj, name); 565 kobject_set_name(&mk->kobj, name);
564 ret = kobject_register(&mk->kobj); 566 kobject_init(&mk->kobj);
567 ret = kobject_add(&mk->kobj);
565 BUG_ON(ret < 0); 568 BUG_ON(ret < 0);
566 569 param_sysfs_setup(mk, kparam, num_params, name_skip);
567 /* no need to keep the kobject if no parameter is exported */ 570 kobject_uevent(&mk->kobj, KOBJ_ADD);
568 if (!param_sysfs_setup(mk, kparam, num_params, name_skip)) {
569 kobject_unregister(&mk->kobj);
570 kfree(mk);
571 }
572} 571}
573 572
574/* 573/*
@@ -674,6 +673,19 @@ static struct sysfs_ops module_sysfs_ops = {
674 .store = module_attr_store, 673 .store = module_attr_store,
675}; 674};
676 675
676static int uevent_filter(struct kset *kset, struct kobject *kobj)
677{
678 struct kobj_type *ktype = get_ktype(kobj);
679
680 if (ktype == &module_ktype)
681 return 1;
682 return 0;
683}
684
685static struct kset_uevent_ops module_uevent_ops = {
686 .filter = uevent_filter,
687};
688
677#else 689#else
678static struct sysfs_ops module_sysfs_ops = { 690static struct sysfs_ops module_sysfs_ops = {
679 .show = NULL, 691 .show = NULL,
@@ -685,7 +697,7 @@ static struct kobj_type module_ktype = {
685 .sysfs_ops = &module_sysfs_ops, 697 .sysfs_ops = &module_sysfs_ops,
686}; 698};
687 699
688decl_subsys(module, &module_ktype, NULL); 700decl_subsys(module, &module_ktype, &module_uevent_ops);
689 701
690/* 702/*
691 * param_sysfs_init - wrapper for built-in params support 703 * param_sysfs_init - wrapper for built-in params support