mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-19 21:21:09 +00:00
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>
This commit is contained in:
parent
c11c4154e7
commit
3514faca19
36 changed files with 84 additions and 87 deletions
|
@ -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, \
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue