diff options
Diffstat (limited to 'kernel/params.c')
-rw-r--r-- | kernel/params.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/kernel/params.c b/kernel/params.c index 7d231c6c1334..7a751570b56d 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 == '-') |
@@ -391,6 +389,7 @@ struct module_param_attrs | |||
391 | struct param_attribute attrs[0]; | 389 | struct param_attribute attrs[0]; |
392 | }; | 390 | }; |
393 | 391 | ||
392 | #ifdef CONFIG_SYSFS | ||
394 | #define to_param_attr(n) container_of(n, struct param_attribute, mattr); | 393 | #define to_param_attr(n) container_of(n, struct param_attribute, mattr); |
395 | 394 | ||
396 | static ssize_t param_attr_show(struct module_attribute *mattr, | 395 | static ssize_t param_attr_show(struct module_attribute *mattr, |
@@ -426,6 +425,7 @@ static ssize_t param_attr_store(struct module_attribute *mattr, | |||
426 | return len; | 425 | return len; |
427 | return err; | 426 | return err; |
428 | } | 427 | } |
428 | #endif | ||
429 | 429 | ||
430 | #ifdef CONFIG_MODULES | 430 | #ifdef CONFIG_MODULES |
431 | #define __modinit | 431 | #define __modinit |
@@ -433,6 +433,7 @@ static ssize_t param_attr_store(struct module_attribute *mattr, | |||
433 | #define __modinit __init | 433 | #define __modinit __init |
434 | #endif | 434 | #endif |
435 | 435 | ||
436 | #ifdef CONFIG_SYSFS | ||
436 | /* | 437 | /* |
437 | * param_sysfs_setup - setup sysfs support for one module or KBUILD_MODNAME | 438 | * param_sysfs_setup - setup sysfs support for one module or KBUILD_MODNAME |
438 | * @mk: struct module_kobject (contains parent kobject) | 439 | * @mk: struct module_kobject (contains parent kobject) |
@@ -500,9 +501,7 @@ param_sysfs_setup(struct module_kobject *mk, | |||
500 | return mp; | 501 | return mp; |
501 | } | 502 | } |
502 | 503 | ||
503 | |||
504 | #ifdef CONFIG_MODULES | 504 | #ifdef CONFIG_MODULES |
505 | |||
506 | /* | 505 | /* |
507 | * module_param_sysfs_setup - setup sysfs support for one module | 506 | * module_param_sysfs_setup - setup sysfs support for one module |
508 | * @mod: module | 507 | * @mod: module |
@@ -625,7 +624,6 @@ static void __init param_sysfs_builtin(void) | |||
625 | 624 | ||
626 | 625 | ||
627 | /* module-related sysfs stuff */ | 626 | /* module-related sysfs stuff */ |
628 | #ifdef CONFIG_SYSFS | ||
629 | 627 | ||
630 | #define to_module_attr(n) container_of(n, struct module_attribute, attr); | 628 | #define to_module_attr(n) container_of(n, struct module_attribute, attr); |
631 | #define to_module_kobject(n) container_of(n, struct module_kobject, kobj); | 629 | #define to_module_kobject(n) container_of(n, struct module_kobject, kobj); |
@@ -673,6 +671,8 @@ static struct sysfs_ops module_sysfs_ops = { | |||
673 | .store = module_attr_store, | 671 | .store = module_attr_store, |
674 | }; | 672 | }; |
675 | 673 | ||
674 | static struct kobj_type module_ktype; | ||
675 | |||
676 | static int uevent_filter(struct kset *kset, struct kobject *kobj) | 676 | static int uevent_filter(struct kset *kset, struct kobject *kobj) |
677 | { | 677 | { |
678 | struct kobj_type *ktype = get_ktype(kobj); | 678 | struct kobj_type *ktype = get_ktype(kobj); |
@@ -686,19 +686,12 @@ static struct kset_uevent_ops module_uevent_ops = { | |||
686 | .filter = uevent_filter, | 686 | .filter = uevent_filter, |
687 | }; | 687 | }; |
688 | 688 | ||
689 | #else | 689 | decl_subsys(module, &module_ktype, &module_uevent_ops); |
690 | static struct sysfs_ops module_sysfs_ops = { | ||
691 | .show = NULL, | ||
692 | .store = NULL, | ||
693 | }; | ||
694 | #endif | ||
695 | 690 | ||
696 | static struct kobj_type module_ktype = { | 691 | static struct kobj_type module_ktype = { |
697 | .sysfs_ops = &module_sysfs_ops, | 692 | .sysfs_ops = &module_sysfs_ops, |
698 | }; | 693 | }; |
699 | 694 | ||
700 | decl_subsys(module, &module_ktype, &module_uevent_ops); | ||
701 | |||
702 | /* | 695 | /* |
703 | * param_sysfs_init - wrapper for built-in params support | 696 | * param_sysfs_init - wrapper for built-in params support |
704 | */ | 697 | */ |
@@ -720,6 +713,15 @@ static int __init param_sysfs_init(void) | |||
720 | } | 713 | } |
721 | subsys_initcall(param_sysfs_init); | 714 | subsys_initcall(param_sysfs_init); |
722 | 715 | ||
716 | #else | ||
717 | #if 0 | ||
718 | static struct sysfs_ops module_sysfs_ops = { | ||
719 | .show = NULL, | ||
720 | .store = NULL, | ||
721 | }; | ||
722 | #endif | ||
723 | #endif | ||
724 | |||
723 | EXPORT_SYMBOL(param_set_byte); | 725 | EXPORT_SYMBOL(param_set_byte); |
724 | EXPORT_SYMBOL(param_get_byte); | 726 | EXPORT_SYMBOL(param_get_byte); |
725 | EXPORT_SYMBOL(param_set_short); | 727 | EXPORT_SYMBOL(param_set_short); |