diff options
author | Fabian Frederick <fabf@skynet.be> | 2014-06-04 19:05:57 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-04 19:53:53 -0400 |
commit | f6b1fe7c27800adba0ccf6063ee97478046eeafe (patch) | |
tree | 639bbcf878df48ac74de5cb072d52b8a8fca501a /fs/configfs/item.c | |
parent | 2accff4ef5c5831a9cc6319394a9f61cc9de8534 (diff) |
fs/configs/item.c: kernel-doc fixes + clean-up
Fix function parameter documentation
EXPORT_SYMBOLS moved after corresponding functions
Small coding style and checkpatch warning fixes
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Acked-by: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/configfs/item.c')
-rw-r--r-- | fs/configfs/item.c | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/fs/configfs/item.c b/fs/configfs/item.c index 50cee7f9110b..e65f9ffbb999 100644 --- a/fs/configfs/item.c +++ b/fs/configfs/item.c | |||
@@ -19,7 +19,7 @@ | |||
19 | * Boston, MA 021110-1307, USA. | 19 | * Boston, MA 021110-1307, USA. |
20 | * | 20 | * |
21 | * Based on kobject: | 21 | * Based on kobject: |
22 | * kobject is Copyright (c) 2002-2003 Patrick Mochel | 22 | * kobject is Copyright (c) 2002-2003 Patrick Mochel |
23 | * | 23 | * |
24 | * configfs Copyright (C) 2005 Oracle. All rights reserved. | 24 | * configfs Copyright (C) 2005 Oracle. All rights reserved. |
25 | * | 25 | * |
@@ -35,9 +35,9 @@ | |||
35 | #include <linux/configfs.h> | 35 | #include <linux/configfs.h> |
36 | 36 | ||
37 | 37 | ||
38 | static inline struct config_item * to_item(struct list_head * entry) | 38 | static inline struct config_item *to_item(struct list_head *entry) |
39 | { | 39 | { |
40 | return container_of(entry,struct config_item,ci_entry); | 40 | return container_of(entry, struct config_item, ci_entry); |
41 | } | 41 | } |
42 | 42 | ||
43 | /* Evil kernel */ | 43 | /* Evil kernel */ |
@@ -47,34 +47,35 @@ static void config_item_release(struct kref *kref); | |||
47 | * config_item_init - initialize item. | 47 | * config_item_init - initialize item. |
48 | * @item: item in question. | 48 | * @item: item in question. |
49 | */ | 49 | */ |
50 | void config_item_init(struct config_item * item) | 50 | void config_item_init(struct config_item *item) |
51 | { | 51 | { |
52 | kref_init(&item->ci_kref); | 52 | kref_init(&item->ci_kref); |
53 | INIT_LIST_HEAD(&item->ci_entry); | 53 | INIT_LIST_HEAD(&item->ci_entry); |
54 | } | 54 | } |
55 | EXPORT_SYMBOL(config_item_init); | ||
55 | 56 | ||
56 | /** | 57 | /** |
57 | * config_item_set_name - Set the name of an item | 58 | * config_item_set_name - Set the name of an item |
58 | * @item: item. | 59 | * @item: item. |
59 | * @name: name. | 60 | * @fmt: The vsnprintf()'s format string. |
60 | * | 61 | * |
61 | * If strlen(name) >= CONFIGFS_ITEM_NAME_LEN, then use a | 62 | * If strlen(name) >= CONFIGFS_ITEM_NAME_LEN, then use a |
62 | * dynamically allocated string that @item->ci_name points to. | 63 | * dynamically allocated string that @item->ci_name points to. |
63 | * Otherwise, use the static @item->ci_namebuf array. | 64 | * Otherwise, use the static @item->ci_namebuf array. |
64 | */ | 65 | */ |
65 | int config_item_set_name(struct config_item * item, const char * fmt, ...) | 66 | int config_item_set_name(struct config_item *item, const char *fmt, ...) |
66 | { | 67 | { |
67 | int error = 0; | 68 | int error = 0; |
68 | int limit = CONFIGFS_ITEM_NAME_LEN; | 69 | int limit = CONFIGFS_ITEM_NAME_LEN; |
69 | int need; | 70 | int need; |
70 | va_list args; | 71 | va_list args; |
71 | char * name; | 72 | char *name; |
72 | 73 | ||
73 | /* | 74 | /* |
74 | * First, try the static array | 75 | * First, try the static array |
75 | */ | 76 | */ |
76 | va_start(args,fmt); | 77 | va_start(args, fmt); |
77 | need = vsnprintf(item->ci_namebuf,limit,fmt,args); | 78 | need = vsnprintf(item->ci_namebuf, limit, fmt, args); |
78 | va_end(args); | 79 | va_end(args); |
79 | if (need < limit) | 80 | if (need < limit) |
80 | name = item->ci_namebuf; | 81 | name = item->ci_namebuf; |
@@ -83,13 +84,13 @@ int config_item_set_name(struct config_item * item, const char * fmt, ...) | |||
83 | * Need more space? Allocate it and try again | 84 | * Need more space? Allocate it and try again |
84 | */ | 85 | */ |
85 | limit = need + 1; | 86 | limit = need + 1; |
86 | name = kmalloc(limit,GFP_KERNEL); | 87 | name = kmalloc(limit, GFP_KERNEL); |
87 | if (!name) { | 88 | if (!name) { |
88 | error = -ENOMEM; | 89 | error = -ENOMEM; |
89 | goto Done; | 90 | goto Done; |
90 | } | 91 | } |
91 | va_start(args,fmt); | 92 | va_start(args, fmt); |
92 | need = vsnprintf(name,limit,fmt,args); | 93 | need = vsnprintf(name, limit, fmt, args); |
93 | va_end(args); | 94 | va_end(args); |
94 | 95 | ||
95 | /* Still? Give up. */ | 96 | /* Still? Give up. */ |
@@ -109,7 +110,6 @@ int config_item_set_name(struct config_item * item, const char * fmt, ...) | |||
109 | Done: | 110 | Done: |
110 | return error; | 111 | return error; |
111 | } | 112 | } |
112 | |||
113 | EXPORT_SYMBOL(config_item_set_name); | 113 | EXPORT_SYMBOL(config_item_set_name); |
114 | 114 | ||
115 | void config_item_init_type_name(struct config_item *item, | 115 | void config_item_init_type_name(struct config_item *item, |
@@ -131,20 +131,21 @@ void config_group_init_type_name(struct config_group *group, const char *name, | |||
131 | } | 131 | } |
132 | EXPORT_SYMBOL(config_group_init_type_name); | 132 | EXPORT_SYMBOL(config_group_init_type_name); |
133 | 133 | ||
134 | struct config_item * config_item_get(struct config_item * item) | 134 | struct config_item *config_item_get(struct config_item *item) |
135 | { | 135 | { |
136 | if (item) | 136 | if (item) |
137 | kref_get(&item->ci_kref); | 137 | kref_get(&item->ci_kref); |
138 | return item; | 138 | return item; |
139 | } | 139 | } |
140 | EXPORT_SYMBOL(config_item_get); | ||
140 | 141 | ||
141 | static void config_item_cleanup(struct config_item * item) | 142 | static void config_item_cleanup(struct config_item *item) |
142 | { | 143 | { |
143 | struct config_item_type * t = item->ci_type; | 144 | struct config_item_type *t = item->ci_type; |
144 | struct config_group * s = item->ci_group; | 145 | struct config_group *s = item->ci_group; |
145 | struct config_item * parent = item->ci_parent; | 146 | struct config_item *parent = item->ci_parent; |
146 | 147 | ||
147 | pr_debug("config_item %s: cleaning up\n",config_item_name(item)); | 148 | pr_debug("config_item %s: cleaning up\n", config_item_name(item)); |
148 | if (item->ci_name != item->ci_namebuf) | 149 | if (item->ci_name != item->ci_namebuf) |
149 | kfree(item->ci_name); | 150 | kfree(item->ci_name); |
150 | item->ci_name = NULL; | 151 | item->ci_name = NULL; |
@@ -167,21 +168,23 @@ static void config_item_release(struct kref *kref) | |||
167 | * | 168 | * |
168 | * Decrement the refcount, and if 0, call config_item_cleanup(). | 169 | * Decrement the refcount, and if 0, call config_item_cleanup(). |
169 | */ | 170 | */ |
170 | void config_item_put(struct config_item * item) | 171 | void config_item_put(struct config_item *item) |
171 | { | 172 | { |
172 | if (item) | 173 | if (item) |
173 | kref_put(&item->ci_kref, config_item_release); | 174 | kref_put(&item->ci_kref, config_item_release); |
174 | } | 175 | } |
176 | EXPORT_SYMBOL(config_item_put); | ||
175 | 177 | ||
176 | /** | 178 | /** |
177 | * config_group_init - initialize a group for use | 179 | * config_group_init - initialize a group for use |
178 | * @k: group | 180 | * @group: config_group |
179 | */ | 181 | */ |
180 | void config_group_init(struct config_group *group) | 182 | void config_group_init(struct config_group *group) |
181 | { | 183 | { |
182 | config_item_init(&group->cg_item); | 184 | config_item_init(&group->cg_item); |
183 | INIT_LIST_HEAD(&group->cg_children); | 185 | INIT_LIST_HEAD(&group->cg_children); |
184 | } | 186 | } |
187 | EXPORT_SYMBOL(config_group_init); | ||
185 | 188 | ||
186 | /** | 189 | /** |
187 | * config_group_find_item - search for item in group. | 190 | * config_group_find_item - search for item in group. |
@@ -195,11 +198,11 @@ void config_group_init(struct config_group *group) | |||
195 | struct config_item *config_group_find_item(struct config_group *group, | 198 | struct config_item *config_group_find_item(struct config_group *group, |
196 | const char *name) | 199 | const char *name) |
197 | { | 200 | { |
198 | struct list_head * entry; | 201 | struct list_head *entry; |
199 | struct config_item * ret = NULL; | 202 | struct config_item *ret = NULL; |
200 | 203 | ||
201 | list_for_each(entry,&group->cg_children) { | 204 | list_for_each(entry, &group->cg_children) { |
202 | struct config_item * item = to_item(entry); | 205 | struct config_item *item = to_item(entry); |
203 | if (config_item_name(item) && | 206 | if (config_item_name(item) && |
204 | !strcmp(config_item_name(item), name)) { | 207 | !strcmp(config_item_name(item), name)) { |
205 | ret = config_item_get(item); | 208 | ret = config_item_get(item); |
@@ -208,9 +211,4 @@ struct config_item *config_group_find_item(struct config_group *group, | |||
208 | } | 211 | } |
209 | return ret; | 212 | return ret; |
210 | } | 213 | } |
211 | |||
212 | EXPORT_SYMBOL(config_item_init); | ||
213 | EXPORT_SYMBOL(config_group_init); | ||
214 | EXPORT_SYMBOL(config_item_get); | ||
215 | EXPORT_SYMBOL(config_item_put); | ||
216 | EXPORT_SYMBOL(config_group_find_item); | 214 | EXPORT_SYMBOL(config_group_find_item); |