Commit f6b1fe7c authored by Fabian Frederick's avatar Fabian Frederick Committed by Linus Torvalds

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: default avatarFabian Frederick <fabf@skynet.be>
Acked-by: default avatarJoel Becker <jlbec@evilplan.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2accff4e
...@@ -35,9 +35,9 @@ ...@@ -35,9 +35,9 @@
#include <linux/configfs.h> #include <linux/configfs.h>
static inline struct config_item * to_item(struct list_head * entry) static inline struct config_item *to_item(struct list_head *entry)
{ {
return container_of(entry,struct config_item,ci_entry); return container_of(entry, struct config_item, ci_entry);
} }
/* Evil kernel */ /* Evil kernel */
...@@ -47,34 +47,35 @@ static void config_item_release(struct kref *kref); ...@@ -47,34 +47,35 @@ static void config_item_release(struct kref *kref);
* config_item_init - initialize item. * config_item_init - initialize item.
* @item: item in question. * @item: item in question.
*/ */
void config_item_init(struct config_item * item) void config_item_init(struct config_item *item)
{ {
kref_init(&item->ci_kref); kref_init(&item->ci_kref);
INIT_LIST_HEAD(&item->ci_entry); INIT_LIST_HEAD(&item->ci_entry);
} }
EXPORT_SYMBOL(config_item_init);
/** /**
* config_item_set_name - Set the name of an item * config_item_set_name - Set the name of an item
* @item: item. * @item: item.
* @name: name. * @fmt: The vsnprintf()'s format string.
* *
* If strlen(name) >= CONFIGFS_ITEM_NAME_LEN, then use a * If strlen(name) >= CONFIGFS_ITEM_NAME_LEN, then use a
* dynamically allocated string that @item->ci_name points to. * dynamically allocated string that @item->ci_name points to.
* Otherwise, use the static @item->ci_namebuf array. * Otherwise, use the static @item->ci_namebuf array.
*/ */
int config_item_set_name(struct config_item * item, const char * fmt, ...) int config_item_set_name(struct config_item *item, const char *fmt, ...)
{ {
int error = 0; int error = 0;
int limit = CONFIGFS_ITEM_NAME_LEN; int limit = CONFIGFS_ITEM_NAME_LEN;
int need; int need;
va_list args; va_list args;
char * name; char *name;
/* /*
* First, try the static array * First, try the static array
*/ */
va_start(args,fmt); va_start(args, fmt);
need = vsnprintf(item->ci_namebuf,limit,fmt,args); need = vsnprintf(item->ci_namebuf, limit, fmt, args);
va_end(args); va_end(args);
if (need < limit) if (need < limit)
name = item->ci_namebuf; name = item->ci_namebuf;
...@@ -83,13 +84,13 @@ int config_item_set_name(struct config_item * item, const char * fmt, ...) ...@@ -83,13 +84,13 @@ int config_item_set_name(struct config_item * item, const char * fmt, ...)
* Need more space? Allocate it and try again * Need more space? Allocate it and try again
*/ */
limit = need + 1; limit = need + 1;
name = kmalloc(limit,GFP_KERNEL); name = kmalloc(limit, GFP_KERNEL);
if (!name) { if (!name) {
error = -ENOMEM; error = -ENOMEM;
goto Done; goto Done;
} }
va_start(args,fmt); va_start(args, fmt);
need = vsnprintf(name,limit,fmt,args); need = vsnprintf(name, limit, fmt, args);
va_end(args); va_end(args);
/* Still? Give up. */ /* Still? Give up. */
...@@ -109,7 +110,6 @@ int config_item_set_name(struct config_item * item, const char * fmt, ...) ...@@ -109,7 +110,6 @@ int config_item_set_name(struct config_item * item, const char * fmt, ...)
Done: Done:
return error; return error;
} }
EXPORT_SYMBOL(config_item_set_name); EXPORT_SYMBOL(config_item_set_name);
void config_item_init_type_name(struct config_item *item, 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,20 +131,21 @@ void config_group_init_type_name(struct config_group *group, const char *name,
} }
EXPORT_SYMBOL(config_group_init_type_name); EXPORT_SYMBOL(config_group_init_type_name);
struct config_item * config_item_get(struct config_item * item) struct config_item *config_item_get(struct config_item *item)
{ {
if (item) if (item)
kref_get(&item->ci_kref); kref_get(&item->ci_kref);
return item; return item;
} }
EXPORT_SYMBOL(config_item_get);
static void config_item_cleanup(struct config_item * item) static void config_item_cleanup(struct config_item *item)
{ {
struct config_item_type * t = item->ci_type; struct config_item_type *t = item->ci_type;
struct config_group * s = item->ci_group; struct config_group *s = item->ci_group;
struct config_item * parent = item->ci_parent; struct config_item *parent = item->ci_parent;
pr_debug("config_item %s: cleaning up\n",config_item_name(item)); pr_debug("config_item %s: cleaning up\n", config_item_name(item));
if (item->ci_name != item->ci_namebuf) if (item->ci_name != item->ci_namebuf)
kfree(item->ci_name); kfree(item->ci_name);
item->ci_name = NULL; item->ci_name = NULL;
...@@ -167,21 +168,23 @@ static void config_item_release(struct kref *kref) ...@@ -167,21 +168,23 @@ static void config_item_release(struct kref *kref)
* *
* Decrement the refcount, and if 0, call config_item_cleanup(). * Decrement the refcount, and if 0, call config_item_cleanup().
*/ */
void config_item_put(struct config_item * item) void config_item_put(struct config_item *item)
{ {
if (item) if (item)
kref_put(&item->ci_kref, config_item_release); kref_put(&item->ci_kref, config_item_release);
} }
EXPORT_SYMBOL(config_item_put);
/** /**
* config_group_init - initialize a group for use * config_group_init - initialize a group for use
* @k: group * @group: config_group
*/ */
void config_group_init(struct config_group *group) void config_group_init(struct config_group *group)
{ {
config_item_init(&group->cg_item); config_item_init(&group->cg_item);
INIT_LIST_HEAD(&group->cg_children); INIT_LIST_HEAD(&group->cg_children);
} }
EXPORT_SYMBOL(config_group_init);
/** /**
* config_group_find_item - search for item in group. * config_group_find_item - search for item in group.
...@@ -195,11 +198,11 @@ void config_group_init(struct config_group *group) ...@@ -195,11 +198,11 @@ void config_group_init(struct config_group *group)
struct config_item *config_group_find_item(struct config_group *group, struct config_item *config_group_find_item(struct config_group *group,
const char *name) const char *name)
{ {
struct list_head * entry; struct list_head *entry;
struct config_item * ret = NULL; struct config_item *ret = NULL;
list_for_each(entry,&group->cg_children) { list_for_each(entry, &group->cg_children) {
struct config_item * item = to_item(entry); struct config_item *item = to_item(entry);
if (config_item_name(item) && if (config_item_name(item) &&
!strcmp(config_item_name(item), name)) { !strcmp(config_item_name(item), name)) {
ret = config_item_get(item); ret = config_item_get(item);
...@@ -208,9 +211,4 @@ struct config_item *config_group_find_item(struct config_group *group, ...@@ -208,9 +211,4 @@ struct config_item *config_group_find_item(struct config_group *group,
} }
return ret; return ret;
} }
EXPORT_SYMBOL(config_item_init);
EXPORT_SYMBOL(config_group_init);
EXPORT_SYMBOL(config_item_get);
EXPORT_SYMBOL(config_item_put);
EXPORT_SYMBOL(config_group_find_item); EXPORT_SYMBOL(config_group_find_item);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment