diff options
| author | Kay Sievers <kay.sievers@vrfy.org> | 2007-12-19 20:09:39 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-24 23:40:40 -0500 |
| commit | af5ca3f4ec5cc4432a42a73b050dd8898ce8fd00 (patch) | |
| tree | 3e5a3081b2802547f10da72c0026b4929d0e287b /include/linux | |
| parent | 528a4bf1d5ffed310d26fc1d82d45c02949f71cf (diff) | |
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>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/kobject.h | 13 | ||||
| -rw-r--r-- | include/linux/sysdev.h | 1 |
2 files changed, 3 insertions, 11 deletions
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 504ac0eb44..4adbe1d830 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
| @@ -61,7 +61,7 @@ enum kobject_action { | |||
| 61 | }; | 61 | }; |
| 62 | 62 | ||
| 63 | struct kobject { | 63 | struct kobject { |
| 64 | const char * k_name; | 64 | const char *name; |
| 65 | struct kref kref; | 65 | struct kref kref; |
| 66 | struct list_head entry; | 66 | struct list_head entry; |
| 67 | struct kobject * parent; | 67 | struct kobject * parent; |
| @@ -69,7 +69,6 @@ struct kobject { | |||
| 69 | struct kobj_type * ktype; | 69 | struct kobj_type * ktype; |
| 70 | struct sysfs_dirent * sd; | 70 | struct sysfs_dirent * sd; |
| 71 | unsigned int state_initialized:1; | 71 | unsigned int state_initialized:1; |
| 72 | unsigned int state_name_set:1; | ||
| 73 | unsigned int state_in_sysfs:1; | 72 | unsigned int state_in_sysfs:1; |
| 74 | unsigned int state_add_uevent_sent:1; | 73 | unsigned int state_add_uevent_sent:1; |
| 75 | unsigned int state_remove_uevent_sent:1; | 74 | unsigned int state_remove_uevent_sent:1; |
| @@ -80,7 +79,7 @@ extern int kobject_set_name(struct kobject *, const char *, ...) | |||
| 80 | 79 | ||
| 81 | static inline const char * kobject_name(const struct kobject * kobj) | 80 | static inline const char * kobject_name(const struct kobject * kobj) |
| 82 | { | 81 | { |
| 83 | return kobj->k_name; | 82 | return kobj->name; |
| 84 | } | 83 | } |
| 85 | 84 | ||
| 86 | extern void kobject_init(struct kobject *kobj, struct kobj_type *ktype); | 85 | 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) | |||
| 189 | 188 | ||
| 190 | extern struct kobject * kset_find_obj(struct kset *, const char *); | 189 | extern struct kobject * kset_find_obj(struct kset *, const char *); |
| 191 | 190 | ||
| 192 | |||
| 193 | /* | ||
| 194 | * Use this when initializing an embedded kset with no other | ||
| 195 | * fields to initialize. | ||
| 196 | */ | ||
| 197 | #define set_kset_name(str) .kset = { .kobj = { .k_name = str } } | ||
| 198 | |||
| 199 | |||
| 200 | /* The global /sys/kernel/ kobject for people to chain off of */ | 191 | /* The global /sys/kernel/ kobject for people to chain off of */ |
| 201 | extern struct kobject *kernel_kobj; | 192 | extern struct kobject *kernel_kobj; |
| 202 | /* The global /sys/hypervisor/ kobject for people to chain off of */ | 193 | /* The global /sys/hypervisor/ kobject for people to chain off of */ |
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h index e285746588..f752e73bf9 100644 --- a/include/linux/sysdev.h +++ b/include/linux/sysdev.h | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | struct sys_device; | 29 | struct sys_device; |
| 30 | 30 | ||
| 31 | struct sysdev_class { | 31 | struct sysdev_class { |
| 32 | const char *name; | ||
| 32 | struct list_head drivers; | 33 | struct list_head drivers; |
| 33 | 34 | ||
| 34 | /* Default operations for these types of devices */ | 35 | /* Default operations for these types of devices */ |
