diff options
Diffstat (limited to 'kernel/params.c')
-rw-r--r-- | kernel/params.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/kernel/params.c b/kernel/params.c index 553cf7d6a4be..1fc4ac746cd8 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 == '-') |
@@ -358,6 +356,10 @@ int param_set_copystring(const char *val, struct kernel_param *kp) | |||
358 | { | 356 | { |
359 | struct kparam_string *kps = kp->arg; | 357 | struct kparam_string *kps = kp->arg; |
360 | 358 | ||
359 | if (!val) { | ||
360 | printk(KERN_ERR "%s: missing param set value\n", kp->name); | ||
361 | return -EINVAL; | ||
362 | } | ||
361 | if (strlen(val)+1 > kps->maxlen) { | 363 | if (strlen(val)+1 > kps->maxlen) { |
362 | printk(KERN_ERR "%s: string doesn't fit in %u chars.\n", | 364 | printk(KERN_ERR "%s: string doesn't fit in %u chars.\n", |
363 | kp->name, kps->maxlen-1); | 365 | kp->name, kps->maxlen-1); |
@@ -391,6 +393,7 @@ struct module_param_attrs | |||
391 | struct param_attribute attrs[0]; | 393 | struct param_attribute attrs[0]; |
392 | }; | 394 | }; |
393 | 395 | ||
396 | #ifdef CONFIG_SYSFS | ||
394 | #define to_param_attr(n) container_of(n, struct param_attribute, mattr); | 397 | #define to_param_attr(n) container_of(n, struct param_attribute, mattr); |
395 | 398 | ||
396 | static ssize_t param_attr_show(struct module_attribute *mattr, | 399 | static ssize_t param_attr_show(struct module_attribute *mattr, |
@@ -426,6 +429,7 @@ static ssize_t param_attr_store(struct module_attribute *mattr, | |||
426 | return len; | 429 | return len; |
427 | return err; | 430 | return err; |
428 | } | 431 | } |
432 | #endif | ||
429 | 433 | ||
430 | #ifdef CONFIG_MODULES | 434 | #ifdef CONFIG_MODULES |
431 | #define __modinit | 435 | #define __modinit |
@@ -433,6 +437,7 @@ static ssize_t param_attr_store(struct module_attribute *mattr, | |||
433 | #define __modinit __init | 437 | #define __modinit __init |
434 | #endif | 438 | #endif |
435 | 439 | ||
440 | #ifdef CONFIG_SYSFS | ||
436 | /* | 441 | /* |
437 | * param_sysfs_setup - setup sysfs support for one module or KBUILD_MODNAME | 442 | * param_sysfs_setup - setup sysfs support for one module or KBUILD_MODNAME |
438 | * @mk: struct module_kobject (contains parent kobject) | 443 | * @mk: struct module_kobject (contains parent kobject) |
@@ -500,9 +505,7 @@ param_sysfs_setup(struct module_kobject *mk, | |||
500 | return mp; | 505 | return mp; |
501 | } | 506 | } |
502 | 507 | ||
503 | |||
504 | #ifdef CONFIG_MODULES | 508 | #ifdef CONFIG_MODULES |
505 | |||
506 | /* | 509 | /* |
507 | * module_param_sysfs_setup - setup sysfs support for one module | 510 | * module_param_sysfs_setup - setup sysfs support for one module |
508 | * @mod: module | 511 | * @mod: module |
@@ -625,7 +628,6 @@ static void __init param_sysfs_builtin(void) | |||
625 | 628 | ||
626 | 629 | ||
627 | /* module-related sysfs stuff */ | 630 | /* module-related sysfs stuff */ |
628 | #ifdef CONFIG_SYSFS | ||
629 | 631 | ||
630 | #define to_module_attr(n) container_of(n, struct module_attribute, attr); | 632 | #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); | 633 | #define to_module_kobject(n) container_of(n, struct module_kobject, kobj); |
@@ -673,6 +675,8 @@ static struct sysfs_ops module_sysfs_ops = { | |||
673 | .store = module_attr_store, | 675 | .store = module_attr_store, |
674 | }; | 676 | }; |
675 | 677 | ||
678 | static struct kobj_type module_ktype; | ||
679 | |||
676 | static int uevent_filter(struct kset *kset, struct kobject *kobj) | 680 | static int uevent_filter(struct kset *kset, struct kobject *kobj) |
677 | { | 681 | { |
678 | struct kobj_type *ktype = get_ktype(kobj); | 682 | struct kobj_type *ktype = get_ktype(kobj); |
@@ -686,19 +690,12 @@ static struct kset_uevent_ops module_uevent_ops = { | |||
686 | .filter = uevent_filter, | 690 | .filter = uevent_filter, |
687 | }; | 691 | }; |
688 | 692 | ||
689 | #else | 693 | 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 | 694 | ||
696 | static struct kobj_type module_ktype = { | 695 | static struct kobj_type module_ktype = { |
697 | .sysfs_ops = &module_sysfs_ops, | 696 | .sysfs_ops = &module_sysfs_ops, |
698 | }; | 697 | }; |
699 | 698 | ||
700 | decl_subsys(module, &module_ktype, &module_uevent_ops); | ||
701 | |||
702 | /* | 699 | /* |
703 | * param_sysfs_init - wrapper for built-in params support | 700 | * param_sysfs_init - wrapper for built-in params support |
704 | */ | 701 | */ |
@@ -719,6 +716,15 @@ static int __init param_sysfs_init(void) | |||
719 | } | 716 | } |
720 | subsys_initcall(param_sysfs_init); | 717 | subsys_initcall(param_sysfs_init); |
721 | 718 | ||
719 | #else | ||
720 | #if 0 | ||
721 | static struct sysfs_ops module_sysfs_ops = { | ||
722 | .show = NULL, | ||
723 | .store = NULL, | ||
724 | }; | ||
725 | #endif | ||
726 | #endif | ||
727 | |||
722 | EXPORT_SYMBOL(param_set_byte); | 728 | EXPORT_SYMBOL(param_set_byte); |
723 | EXPORT_SYMBOL(param_get_byte); | 729 | EXPORT_SYMBOL(param_get_byte); |
724 | EXPORT_SYMBOL(param_set_short); | 730 | EXPORT_SYMBOL(param_set_short); |