diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-09-12 18:06:57 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-12 17:51:02 -0400 |
commit | ce2c9cb0259acd2aed184499ebe41ab00da13b25 (patch) | |
tree | 1c0b25cc5cff7f7778b3e8c7441c2f5d89f027f6 /include/linux/kobject.h | |
parent | 34980ca8faebfcce31094eba6ffbb0113950361f (diff) |
kobject: remove the static array for the name
Due to historical reasons, struct kobject contained a static array for
the name, and a dynamic pointer in case the name got bigger than the
array. That's just dumb, as people didn't always know which variable to
reference, even with the accessor for the kobject name.
This patch removes the static array, potentially saving a lot of memory
as the majority of kobjects do not have a very long name.
Thanks to Kay for the idea to do this.
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/kobject.h')
-rw-r--r-- | include/linux/kobject.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index c0fb535d7acd..8b45946e8506 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
@@ -63,7 +63,6 @@ extern const char *kobject_actions[]; | |||
63 | 63 | ||
64 | struct kobject { | 64 | struct kobject { |
65 | const char * k_name; | 65 | const char * k_name; |
66 | char name[KOBJ_NAME_LEN]; | ||
67 | struct kref kref; | 66 | struct kref kref; |
68 | struct list_head entry; | 67 | struct list_head entry; |
69 | struct kobject * parent; | 68 | struct kobject * parent; |
@@ -188,18 +187,18 @@ extern struct kobject * kset_find_obj(struct kset *, const char *); | |||
188 | * Use this when initializing an embedded kset with no other | 187 | * Use this when initializing an embedded kset with no other |
189 | * fields to initialize. | 188 | * fields to initialize. |
190 | */ | 189 | */ |
191 | #define set_kset_name(str) .kset = { .kobj = { .name = str } } | 190 | #define set_kset_name(str) .kset = { .kobj = { .k_name = str } } |
192 | 191 | ||
193 | 192 | ||
194 | #define decl_subsys(_name,_type,_uevent_ops) \ | 193 | #define decl_subsys(_name,_type,_uevent_ops) \ |
195 | struct kset _name##_subsys = { \ | 194 | struct kset _name##_subsys = { \ |
196 | .kobj = { .name = __stringify(_name) }, \ | 195 | .kobj = { .k_name = __stringify(_name) }, \ |
197 | .ktype = _type, \ | 196 | .ktype = _type, \ |
198 | .uevent_ops =_uevent_ops, \ | 197 | .uevent_ops =_uevent_ops, \ |
199 | } | 198 | } |
200 | #define decl_subsys_name(_varname,_name,_type,_uevent_ops) \ | 199 | #define decl_subsys_name(_varname,_name,_type,_uevent_ops) \ |
201 | struct kset _varname##_subsys = { \ | 200 | struct kset _varname##_subsys = { \ |
202 | .kobj = { .name = __stringify(_name) }, \ | 201 | .kobj = { .k_name = __stringify(_name) }, \ |
203 | .ktype = _type, \ | 202 | .ktype = _type, \ |
204 | .uevent_ops =_uevent_ops, \ | 203 | .uevent_ops =_uevent_ops, \ |
205 | } | 204 | } |