diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-16 12:11:44 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-24 23:40:10 -0500 |
commit | 3514faca19a6fdc209734431c509631ea92b094e (patch) | |
tree | f6d102e6dec276f8e8d1044b47c74a02b901554f /include/linux/kobject.h | |
parent | c11c4154e7ff4cebfadad849b1e22689d759c3f4 (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 'include/linux/kobject.h')
-rw-r--r-- | include/linux/kobject.h | 15 |
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 { | |||
135 | * define the attribute callbacks and other common events that happen to | 135 | * define the attribute callbacks and other common events that happen to |
136 | * a kobject. | 136 | * a kobject. |
137 | * | 137 | * |
138 | * @ktype: the struct kobj_type for this specific kset | ||
139 | * @list: the list of all kobjects for this kset | 138 | * @list: the list of all kobjects for this kset |
140 | * @list_lock: a lock for iterating over the kobjects | 139 | * @list_lock: a lock for iterating over the kobjects |
141 | * @kobj: the embedded kobject for this kset (recursion, isn't it fun...) | 140 | * @kobj: the embedded kobject for this kset (recursion, isn't it fun...) |
@@ -145,7 +144,6 @@ struct kset_uevent_ops { | |||
145 | * desired. | 144 | * desired. |
146 | */ | 145 | */ |
147 | struct kset { | 146 | struct kset { |
148 | struct kobj_type *ktype; | ||
149 | struct list_head list; | 147 | struct list_head list; |
150 | spinlock_t list_lock; | 148 | spinlock_t list_lock; |
151 | struct kobject kobj; | 149 | struct kobject kobj; |
@@ -173,12 +171,9 @@ static inline void kset_put(struct kset * k) | |||
173 | kobject_put(&k->kobj); | 171 | kobject_put(&k->kobj); |
174 | } | 172 | } |
175 | 173 | ||
176 | static inline struct kobj_type * get_ktype(struct kobject * k) | 174 | static inline struct kobj_type *get_ktype(struct kobject *kobj) |
177 | { | 175 | { |
178 | if (k->kset && k->kset->ktype) | 176 | return kobj->ktype; |
179 | return k->kset->ktype; | ||
180 | else | ||
181 | return k->ktype; | ||
182 | } | 177 | } |
183 | 178 | ||
184 | extern struct kobject * kset_find_obj(struct kset *, const char *); | 179 | extern struct kobject * kset_find_obj(struct kset *, const char *); |
@@ -191,16 +186,14 @@ extern struct kobject * kset_find_obj(struct kset *, const char *); | |||
191 | #define set_kset_name(str) .kset = { .kobj = { .k_name = str } } | 186 | #define set_kset_name(str) .kset = { .kobj = { .k_name = str } } |
192 | 187 | ||
193 | 188 | ||
194 | #define decl_subsys(_name,_type,_uevent_ops) \ | 189 | #define decl_subsys(_name,_uevent_ops) \ |
195 | struct kset _name##_subsys = { \ | 190 | struct kset _name##_subsys = { \ |
196 | .kobj = { .k_name = __stringify(_name) }, \ | 191 | .kobj = { .k_name = __stringify(_name) }, \ |
197 | .ktype = _type, \ | ||
198 | .uevent_ops =_uevent_ops, \ | 192 | .uevent_ops =_uevent_ops, \ |
199 | } | 193 | } |
200 | #define decl_subsys_name(_varname,_name,_type,_uevent_ops) \ | 194 | #define decl_subsys_name(_varname,_name,_uevent_ops) \ |
201 | struct kset _varname##_subsys = { \ | 195 | struct kset _varname##_subsys = { \ |
202 | .kobj = { .k_name = __stringify(_name) }, \ | 196 | .kobj = { .k_name = __stringify(_name) }, \ |
203 | .ktype = _type, \ | ||
204 | .uevent_ops =_uevent_ops, \ | 197 | .uevent_ops =_uevent_ops, \ |
205 | } | 198 | } |
206 | 199 | ||