Skip to content

Commit f6b1fe7

Browse files
Fabian Fredericktorvalds
authored andcommitted
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>
1 parent 2accff4 commit f6b1fe7

1 file changed

Lines changed: 28 additions & 30 deletions

File tree

‎fs/configfs/item.c‎

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* Boston, MA 021110-1307, USA.
2020
*
2121
* Based on kobject:
22-
* kobject is Copyright (c) 2002-2003 Patrick Mochel
22+
* kobject is Copyright (c) 2002-2003 Patrick Mochel
2323
*
2424
* configfs Copyright (C) 2005 Oracle. All rights reserved.
2525
*
@@ -35,9 +35,9 @@
3535
#include <linux/configfs.h>
3636

3737

38-
static inline struct config_item * to_item(struct list_head * entry)
38+
static inline struct config_item *to_item(struct list_head *entry)
3939
{
40-
return container_of(entry,struct config_item,ci_entry);
40+
return container_of(entry, struct config_item, ci_entry);
4141
}
4242

4343
/* Evil kernel */
@@ -47,34 +47,35 @@ static void config_item_release(struct kref *kref);
4747
* config_item_init - initialize item.
4848
* @item: item in question.
4949
*/
50-
void config_item_init(struct config_item * item)
50+
void config_item_init(struct config_item *item)
5151
{
5252
kref_init(&item->ci_kref);
5353
INIT_LIST_HEAD(&item->ci_entry);
5454
}
55+
EXPORT_SYMBOL(config_item_init);
5556

5657
/**
5758
* config_item_set_name - Set the name of an item
5859
* @item: item.
59-
* @name: name.
60+
* @fmt: The vsnprintf()'s format string.
6061
*
6162
* If strlen(name) >= CONFIGFS_ITEM_NAME_LEN, then use a
6263
* dynamically allocated string that @item->ci_name points to.
6364
* Otherwise, use the static @item->ci_namebuf array.
6465
*/
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, ...)
6667
{
6768
int error = 0;
6869
int limit = CONFIGFS_ITEM_NAME_LEN;
6970
int need;
7071
va_list args;
71-
char * name;
72+
char *name;
7273

7374
/*
7475
* First, try the static array
7576
*/
76-
va_start(args,fmt);
77-
need = vsnprintf(item->ci_namebuf,limit,fmt,args);
77+
va_start(args, fmt);
78+
need = vsnprintf(item->ci_namebuf, limit, fmt, args);
7879
va_end(args);
7980
if (need < limit)
8081
name = item->ci_namebuf;
@@ -83,13 +84,13 @@ int config_item_set_name(struct config_item * item, const char * fmt, ...)
8384
* Need more space? Allocate it and try again
8485
*/
8586
limit = need + 1;
86-
name = kmalloc(limit,GFP_KERNEL);
87+
name = kmalloc(limit, GFP_KERNEL);
8788
if (!name) {
8889
error = -ENOMEM;
8990
goto Done;
9091
}
91-
va_start(args,fmt);
92-
need = vsnprintf(name,limit,fmt,args);
92+
va_start(args, fmt);
93+
need = vsnprintf(name, limit, fmt, args);
9394
va_end(args);
9495

9596
/* Still? Give up. */
@@ -109,7 +110,6 @@ int config_item_set_name(struct config_item * item, const char * fmt, ...)
109110
Done:
110111
return error;
111112
}
112-
113113
EXPORT_SYMBOL(config_item_set_name);
114114

115115
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,
131131
}
132132
EXPORT_SYMBOL(config_group_init_type_name);
133133

134-
struct config_item * config_item_get(struct config_item * item)
134+
struct config_item *config_item_get(struct config_item *item)
135135
{
136136
if (item)
137137
kref_get(&item->ci_kref);
138138
return item;
139139
}
140+
EXPORT_SYMBOL(config_item_get);
140141

141-
static void config_item_cleanup(struct config_item * item)
142+
static void config_item_cleanup(struct config_item *item)
142143
{
143-
struct config_item_type * t = item->ci_type;
144-
struct config_group * s = item->ci_group;
145-
struct config_item * parent = item->ci_parent;
144+
struct config_item_type *t = item->ci_type;
145+
struct config_group *s = item->ci_group;
146+
struct config_item *parent = item->ci_parent;
146147

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));
148149
if (item->ci_name != item->ci_namebuf)
149150
kfree(item->ci_name);
150151
item->ci_name = NULL;
@@ -167,21 +168,23 @@ static void config_item_release(struct kref *kref)
167168
*
168169
* Decrement the refcount, and if 0, call config_item_cleanup().
169170
*/
170-
void config_item_put(struct config_item * item)
171+
void config_item_put(struct config_item *item)
171172
{
172173
if (item)
173174
kref_put(&item->ci_kref, config_item_release);
174175
}
176+
EXPORT_SYMBOL(config_item_put);
175177

176178
/**
177179
* config_group_init - initialize a group for use
178-
* @k: group
180+
* @group: config_group
179181
*/
180182
void config_group_init(struct config_group *group)
181183
{
182184
config_item_init(&group->cg_item);
183185
INIT_LIST_HEAD(&group->cg_children);
184186
}
187+
EXPORT_SYMBOL(config_group_init);
185188

186189
/**
187190
* config_group_find_item - search for item in group.
@@ -195,11 +198,11 @@ void config_group_init(struct config_group *group)
195198
struct config_item *config_group_find_item(struct config_group *group,
196199
const char *name)
197200
{
198-
struct list_head * entry;
199-
struct config_item * ret = NULL;
201+
struct list_head *entry;
202+
struct config_item *ret = NULL;
200203

201-
list_for_each(entry,&group->cg_children) {
202-
struct config_item * item = to_item(entry);
204+
list_for_each(entry, &group->cg_children) {
205+
struct config_item *item = to_item(entry);
203206
if (config_item_name(item) &&
204207
!strcmp(config_item_name(item), name)) {
205208
ret = config_item_get(item);
@@ -208,9 +211,4 @@ struct config_item *config_group_find_item(struct config_group *group,
208211
}
209212
return ret;
210213
}
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);
216214
EXPORT_SYMBOL(config_group_find_item);

0 commit comments

Comments
 (0)