aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kobject.h
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-10-16 10:11:44 -0600
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 20:40:10 -0800
commit3514faca19a6fdc209734431c509631ea92b094e (patch)
treef6d102e6dec276f8e8d1044b47c74a02b901554f /include/linux/kobject.h
parentkobject: add kobject_init_and_add function (diff)
downloadlinux-dev-3514faca19a6fdc209734431c509631ea92b094e.tar.xz
linux-dev-3514faca19a6fdc209734431c509631ea92b094e.zip
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 'include/linux/kobject.h')
-rw-r--r--include/linux/kobject.h15
1 files changed, 4 insertions, 11 deletions
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index e2b8c3dae425..5031565ab30d 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -135,7 +135,6 @@ struct kset_uevent_ops {
* define the attribute callbacks and other common events that happen to
* a kobject.
*
- * @ktype: the struct kobj_type for this specific kset
* @list: the list of all kobjects for this kset
* @list_lock: a lock for iterating over the kobjects
* @kobj: the embedded kobject for this kset (recursion, isn't it fun...)
@@ -145,7 +144,6 @@ struct kset_uevent_ops {
* desired.
*/
struct kset {
- struct kobj_type *ktype;
struct list_head list;
spinlock_t list_lock;
struct kobject kobj;
@@ -173,12 +171,9 @@ static inline void kset_put(struct kset * k)
kobject_put(&k->kobj);
}
-static inline struct kobj_type * get_ktype(struct kobject * k)
+static inline struct kobj_type *get_ktype(struct kobject *kobj)
{
- if (k->kset && k->kset->ktype)
- return k->kset->ktype;
- else
- return k->ktype;
+ return kobj->ktype;
}
extern struct kobject * kset_find_obj(struct kset *, const char *);
@@ -191,16 +186,14 @@ extern struct kobject * kset_find_obj(struct kset *, const char *);
#define set_kset_name(str) .kset = { .kobj = { .k_name = str } }
-#define decl_subsys(_name,_type,_uevent_ops) \
+#define decl_subsys(_name,_uevent_ops) \
struct kset _name##_subsys = { \
.kobj = { .k_name = __stringify(_name) }, \
- .ktype = _type, \
.uevent_ops =_uevent_ops, \
}
-#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \
+#define decl_subsys_name(_varname,_name,_uevent_ops) \
struct kset _varname##_subsys = { \
.kobj = { .k_name = __stringify(_name) }, \
- .ktype = _type, \
.uevent_ops =_uevent_ops, \
}