diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-07 22:22:26 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-07 22:22:26 -0500 |
commit | f2aca47dc3c2d0c2d5dbd972558557e74232bbce (patch) | |
tree | eae58f599a25a1f3ab41bf616a2b7c4b3c6e2277 /kernel/params.c | |
parent | 7677ced48e2bbbb8d847d34f37e5d96d2b0e41e4 (diff) | |
parent | b592fcfe7f06c15ec11774b5be7ce0de3aa86e73 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (28 commits)
sysfs: Shadow directory support
Driver Core: Increase the default timeout value of the firmware subsystem
Driver core: allow to delay the uevent at device creation time
Driver core: add device_type to struct device
Driver core: add uevent vars for devices of a class
SYSFS: Fix missing include of list.h in sysfs.h
HOWTO: Add a reference to Harbison and Steele
sysfs: error handling in sysfs, fill_read_buffer()
kobject: kobject_put cleanup
sysfs: kobject_put cleanup
sysfs: suppress lockdep warnings
Driver core: fix race in sysfs between sysfs_remove_file() and read()/write()
driver core: Change function call order in device_bind_driver().
driver core: Don't stop probing on ->probe errors.
driver core fixes: device_register() retval check in platform.c
driver core fixes: make_class_name() retval checks
/sys/modules/*/holders
USB: add the sysfs driver name to all modules
SERIO: add the sysfs driver name to all modules
PCI: add the sysfs driver name to all modules
...
Diffstat (limited to 'kernel/params.c')
-rw-r--r-- | kernel/params.c | 28 |
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 | ||
33 | static struct kobj_type module_ktype; | ||
34 | |||
33 | static inline char dash2underscore(char c) | 35 | static 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 | ||
676 | static 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 | |||
685 | static struct kset_uevent_ops module_uevent_ops = { | ||
686 | .filter = uevent_filter, | ||
687 | }; | ||
688 | |||
677 | #else | 689 | #else |
678 | static struct sysfs_ops module_sysfs_ops = { | 690 | static 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 | ||
688 | decl_subsys(module, &module_ktype, NULL); | 700 | decl_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 |