aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/params.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 11:34:42 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 11:35:13 -0500
commitdf8dc74e8a383eaf2d9b44b80a71ec6f0e52b42e (patch)
treebc3799a43e8b94fa84b32e37b1c124d5e4868f50 /kernel/params.c
parent556a169dab38b5100df6f4a45b655dddd3db94c1 (diff)
parent4a3ad20ccd8f4d2a0535cf98fa83f7b561ba59a9 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
This can be broken down into these major areas: - Documentation updates (language translations and fixes, as well as kobject and kset documenatation updates.) - major kset/kobject/ktype rework and fixes. This cleans up the kset and kobject and ktype relationship and architecture, making sense of things now, and good documenation and samples are provided for others to use. Also the attributes for kobjects are much easier to handle now. This cleaned up a LOT of code all through the kernel, making kobjects easier to use if you want to. - struct bus_type has been reworked to now handle the lifetime rules properly, as the kobject is properly dynamic. - struct driver has also been reworked, and now the lifetime issues are resolved. - the block subsystem has been converted to use struct device now, and not "raw" kobjects. This patch has been in the -mm tree for over a year now, and finally all the issues are worked out with it. Older distros now properly work with new kernels, and no userspace updates are needed at all. - nozomi driver is added. This has also been in -mm for a long time, and many people have asked for it to go in. It is now in good enough shape to do so. - lots of class_device conversions to use struct device instead. The tree is almost all cleaned up now, only SCSI and IB is the remaining code to fix up... * git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6: (196 commits) Driver core: coding style fixes Kobject: fix coding style issues in kobject c files Kobject: fix coding style issues in kobject.h Driver core: fix coding style issues in device.h spi: use class iteration api scsi: use class iteration api rtc: use class iteration api power supply : use class iteration api ieee1394: use class iteration api Driver Core: add class iteration api Driver core: Cleanup get_device_parent() in device_add() and device_move() UIO: constify function pointer tables Driver Core: constify the name passed to platform_device_register_simple driver core: fix build with SYSFS=n sysfs: make SYSFS_DEPRECATED depend on SYSFS Driver core: use LIST_HEAD instead of call to INIT_LIST_HEAD in __init kobject: add sample code for how to use ksets/ktypes/kobjects kobject: add sample code for how to use kobjects in a simple manner. kobject: update the kobject/kset documentation kobject: remove old, outdated documentation. ...
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 7686417ee00e..b4da9505f4d2 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);