summaryrefslogtreecommitdiffstats
path: root/sound/core/info.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-05-18 09:43:30 +0200
committerTakashi Iwai <tiwai@suse.de>2015-05-18 09:44:28 +0200
commit8e7ccb7ba3b67245e7be0cadbdd2aaf4a3ba1f40 (patch)
tree4423350a4b6621310a9746adffd657ae0c9e9f2d /sound/core/info.c
parent2471b6c80a70e80de69f5ff4c37187c3912e5874 (diff)
downloadlinux-8e7ccb7ba3b67245e7be0cadbdd2aaf4a3ba1f40.tar.bz2
ALSA: info: Move list addition to snd_info_create_entry()
Just a minor refactoring, no functional changes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/info.c')
-rw-r--r--sound/core/info.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/sound/core/info.c b/sound/core/info.c
index 13b174464cc8..76cdf1d21f17 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -455,11 +455,12 @@ static struct snd_info_entry *create_subdir(struct module *mod,
return entry;
}
-static struct snd_info_entry *snd_info_create_entry(const char *name);
+static struct snd_info_entry *
+snd_info_create_entry(const char *name, struct snd_info_entry *parent);
int __init snd_info_init(void)
{
- snd_proc_root = snd_info_create_entry("asound");
+ snd_proc_root = snd_info_create_entry("asound", NULL);
if (!snd_proc_root)
return -ENOMEM;
snd_proc_root->mode = S_IFDIR | S_IRUGO | S_IXUGO;
@@ -688,6 +689,7 @@ EXPORT_SYMBOL(snd_info_get_str);
/**
* snd_info_create_entry - create an info entry
* @name: the proc file name
+ * @parent: the parent directory
*
* Creates an info entry with the given file name and initializes as
* the default state.
@@ -697,7 +699,8 @@ EXPORT_SYMBOL(snd_info_get_str);
*
* Return: The pointer of the new instance, or %NULL on failure.
*/
-static struct snd_info_entry *snd_info_create_entry(const char *name)
+static struct snd_info_entry *
+snd_info_create_entry(const char *name, struct snd_info_entry *parent)
{
struct snd_info_entry *entry;
entry = kzalloc(sizeof(*entry), GFP_KERNEL);
@@ -713,6 +716,9 @@ static struct snd_info_entry *snd_info_create_entry(const char *name)
mutex_init(&entry->access);
INIT_LIST_HEAD(&entry->children);
INIT_LIST_HEAD(&entry->list);
+ entry->parent = parent;
+ if (parent)
+ list_add_tail(&entry->list, &parent->children);
return entry;
}
@@ -730,13 +736,9 @@ struct snd_info_entry *snd_info_create_module_entry(struct module * module,
const char *name,
struct snd_info_entry *parent)
{
- struct snd_info_entry *entry = snd_info_create_entry(name);
- if (entry) {
+ struct snd_info_entry *entry = snd_info_create_entry(name, parent);
+ if (entry)
entry->module = module;
- entry->parent = parent;
- if (parent)
- list_add_tail(&entry->list, &parent->children);
- }
return entry;
}
@@ -756,13 +758,10 @@ struct snd_info_entry *snd_info_create_card_entry(struct snd_card *card,
const char *name,
struct snd_info_entry * parent)
{
- struct snd_info_entry *entry = snd_info_create_entry(name);
+ struct snd_info_entry *entry = snd_info_create_entry(name, parent);
if (entry) {
entry->module = card->module;
entry->card = card;
- entry->parent = parent;
- if (parent)
- list_add_tail(&entry->list, &parent->children);
}
return entry;
}