Driver core: change sysdev classes to use dynamic kobject names
All kobjects require a dynamically allocated name now. We no longer need to keep track if the name is statically assigned, we can just unconditionally free() all kobject names on cleanup. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
528a4bf1d5
commit
af5ca3f4ec
@@ -61,7 +61,7 @@ enum kobject_action {
|
||||
};
|
||||
|
||||
struct kobject {
|
||||
const char * k_name;
|
||||
const char *name;
|
||||
struct kref kref;
|
||||
struct list_head entry;
|
||||
struct kobject * parent;
|
||||
@@ -69,7 +69,6 @@ struct kobject {
|
||||
struct kobj_type * ktype;
|
||||
struct sysfs_dirent * sd;
|
||||
unsigned int state_initialized:1;
|
||||
unsigned int state_name_set:1;
|
||||
unsigned int state_in_sysfs:1;
|
||||
unsigned int state_add_uevent_sent:1;
|
||||
unsigned int state_remove_uevent_sent:1;
|
||||
@@ -80,7 +79,7 @@ extern int kobject_set_name(struct kobject *, const char *, ...)
|
||||
|
||||
static inline const char * kobject_name(const struct kobject * kobj)
|
||||
{
|
||||
return kobj->k_name;
|
||||
return kobj->name;
|
||||
}
|
||||
|
||||
extern void kobject_init(struct kobject *kobj, struct kobj_type *ktype);
|
||||
@@ -189,14 +188,6 @@ static inline struct kobj_type *get_ktype(struct kobject *kobj)
|
||||
|
||||
extern struct kobject * kset_find_obj(struct kset *, const char *);
|
||||
|
||||
|
||||
/*
|
||||
* Use this when initializing an embedded kset with no other
|
||||
* fields to initialize.
|
||||
*/
|
||||
#define set_kset_name(str) .kset = { .kobj = { .k_name = str } }
|
||||
|
||||
|
||||
/* The global /sys/kernel/ kobject for people to chain off of */
|
||||
extern struct kobject *kernel_kobj;
|
||||
/* The global /sys/hypervisor/ kobject for people to chain off of */
|
||||
|
Reference in New Issue
Block a user