aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-10-16 12:11:44 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 23:40:10 -0500
commit3514faca19a6fdc209734431c509631ea92b094e (patch)
treef6d102e6dec276f8e8d1044b47c74a02b901554f /kernel
parentc11c4154e7ff4cebfadad849b1e22689d759c3f4 (diff)
kobject: remove struct kobj_type from struct kset
We don't need a "default" ktype for a kset. We should set this explicitly every time for each kset. This change is needed so that we can make ksets dynamic, and cleans up one of the odd, undocumented assumption that the kset/kobject/ktype model has. This patch is based on a lot of help from Kay Sievers. Nasty bug in the block code was found by Dave Young <hidave.darkstar@gmail.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Dave Young <hidave.darkstar@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/ksysfs.c2
-rw-r--r--kernel/module.c2
-rw-r--r--kernel/params.c9
-rw-r--r--kernel/power/main.c2
4 files changed, 8 insertions, 7 deletions
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
index 65daa5373ca6..094e2bc101a8 100644
--- a/kernel/ksysfs.c
+++ b/kernel/ksysfs.c
@@ -94,7 +94,7 @@ static struct bin_attribute notes_attr = {
94 .read = &notes_read, 94 .read = &notes_read,
95}; 95};
96 96
97decl_subsys(kernel, NULL, NULL); 97decl_subsys(kernel, NULL);
98EXPORT_SYMBOL_GPL(kernel_subsys); 98EXPORT_SYMBOL_GPL(kernel_subsys);
99 99
100static struct attribute * kernel_attrs[] = { 100static struct attribute * kernel_attrs[] = {
diff --git a/kernel/module.c b/kernel/module.c
index c2e3e2e98801..68df79738b3b 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1223,7 +1223,7 @@ int mod_sysfs_init(struct module *mod)
1223 err = kobject_set_name(&mod->mkobj.kobj, "%s", mod->name); 1223 err = kobject_set_name(&mod->mkobj.kobj, "%s", mod->name);
1224 if (err) 1224 if (err)
1225 goto out; 1225 goto out;
1226 kobj_set_kset_s(&mod->mkobj, module_subsys); 1226 mod->mkobj.kobj.kset = &module_subsys;
1227 mod->mkobj.mod = mod; 1227 mod->mkobj.mod = mod;
1228 1228
1229 kobject_init(&mod->mkobj.kobj); 1229 kobject_init(&mod->mkobj.kobj);
diff --git a/kernel/params.c b/kernel/params.c
index 7686417ee00e..9f051824097d 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 == '-')
@@ -560,7 +562,8 @@ static void __init kernel_param_sysfs_setup(const char *name,
560 BUG_ON(!mk); 562 BUG_ON(!mk);
561 563
562 mk->mod = THIS_MODULE; 564 mk->mod = THIS_MODULE;
563 kobj_set_kset_s(mk, module_subsys); 565 mk->kobj.kset = &module_subsys;
566 mk->kobj.ktype = &module_ktype;
564 kobject_set_name(&mk->kobj, name); 567 kobject_set_name(&mk->kobj, name);
565 kobject_init(&mk->kobj); 568 kobject_init(&mk->kobj);
566 ret = kobject_add(&mk->kobj); 569 ret = kobject_add(&mk->kobj);
@@ -679,8 +682,6 @@ static struct sysfs_ops module_sysfs_ops = {
679 .store = module_attr_store, 682 .store = module_attr_store,
680}; 683};
681 684
682static struct kobj_type module_ktype;
683
684static int uevent_filter(struct kset *kset, struct kobject *kobj) 685static int uevent_filter(struct kset *kset, struct kobject *kobj)
685{ 686{
686 struct kobj_type *ktype = get_ktype(kobj); 687 struct kobj_type *ktype = get_ktype(kobj);
@@ -694,7 +695,7 @@ static struct kset_uevent_ops module_uevent_ops = {
694 .filter = uevent_filter, 695 .filter = uevent_filter,
695}; 696};
696 697
697decl_subsys(module, &module_ktype, &module_uevent_ops); 698decl_subsys(module, &module_uevent_ops);
698int module_sysfs_initialized; 699int module_sysfs_initialized;
699 700
700static void module_release(struct kobject *kobj) 701static void module_release(struct kobject *kobj)
diff --git a/kernel/power/main.c b/kernel/power/main.c
index f71c9504a5c5..1ef31c91ce0e 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -276,7 +276,7 @@ EXPORT_SYMBOL(pm_suspend);
276 276
277#endif /* CONFIG_SUSPEND */ 277#endif /* CONFIG_SUSPEND */
278 278
279decl_subsys(power,NULL,NULL); 279decl_subsys(power, NULL);
280 280
281 281
282/** 282/**