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>
このコミットが含まれているのは:
Greg Kroah-Hartman
2007-10-16 10:11:44 -06:00
コミット 3514faca19
36個のファイルの変更84行の追加87行の削除

ファイルの表示

@@ -94,7 +94,7 @@ static struct bin_attribute notes_attr = {
.read = &notes_read,
};
decl_subsys(kernel, NULL, NULL);
decl_subsys(kernel, NULL);
EXPORT_SYMBOL_GPL(kernel_subsys);
static struct attribute * kernel_attrs[] = {

ファイルの表示

@@ -1223,7 +1223,7 @@ int mod_sysfs_init(struct module *mod)
err = kobject_set_name(&mod->mkobj.kobj, "%s", mod->name);
if (err)
goto out;
kobj_set_kset_s(&mod->mkobj, module_subsys);
mod->mkobj.kobj.kset = &module_subsys;
mod->mkobj.mod = mod;
kobject_init(&mod->mkobj.kobj);

ファイルの表示

@@ -30,6 +30,8 @@
#define DEBUGP(fmt, a...)
#endif
static struct kobj_type module_ktype;
static inline char dash2underscore(char c)
{
if (c == '-')
@@ -560,7 +562,8 @@ static void __init kernel_param_sysfs_setup(const char *name,
BUG_ON(!mk);
mk->mod = THIS_MODULE;
kobj_set_kset_s(mk, module_subsys);
mk->kobj.kset = &module_subsys;
mk->kobj.ktype = &module_ktype;
kobject_set_name(&mk->kobj, name);
kobject_init(&mk->kobj);
ret = kobject_add(&mk->kobj);
@@ -679,8 +682,6 @@ static struct sysfs_ops module_sysfs_ops = {
.store = module_attr_store,
};
static struct kobj_type module_ktype;
static int uevent_filter(struct kset *kset, struct kobject *kobj)
{
struct kobj_type *ktype = get_ktype(kobj);
@@ -694,7 +695,7 @@ static struct kset_uevent_ops module_uevent_ops = {
.filter = uevent_filter,
};
decl_subsys(module, &module_ktype, &module_uevent_ops);
decl_subsys(module, &module_uevent_ops);
int module_sysfs_initialized;
static void module_release(struct kobject *kobj)

ファイルの表示

@@ -276,7 +276,7 @@ EXPORT_SYMBOL(pm_suspend);
#endif /* CONFIG_SUSPEND */
decl_subsys(power,NULL,NULL);
decl_subsys(power, NULL);
/**