Skip to content

Commit a858ee6

Browse files
committed
ALSA: info: Minor optimization
Just a minor code optimization to reduce the source code size slightly. No functional changes. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 9725752 commit a858ee6

1 file changed

Lines changed: 8 additions & 15 deletions

File tree

‎sound/core/info.c‎

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,12 @@ static struct snd_info_entry *create_subdir(struct module *mod,
463463
}
464464

465465
static struct snd_info_entry *
466-
snd_info_create_entry(const char *name, struct snd_info_entry *parent);
466+
snd_info_create_entry(const char *name, struct snd_info_entry *parent,
467+
struct module *module);
467468

468469
int __init snd_info_init(void)
469470
{
470-
snd_proc_root = snd_info_create_entry("asound", NULL);
471+
snd_proc_root = snd_info_create_entry("asound", NULL, THIS_MODULE);
471472
if (!snd_proc_root)
472473
return -ENOMEM;
473474
snd_proc_root->mode = S_IFDIR | 0555;
@@ -684,7 +685,8 @@ EXPORT_SYMBOL(snd_info_get_str);
684685
* Return: The pointer of the new instance, or %NULL on failure.
685686
*/
686687
static struct snd_info_entry *
687-
snd_info_create_entry(const char *name, struct snd_info_entry *parent)
688+
snd_info_create_entry(const char *name, struct snd_info_entry *parent,
689+
struct module *module)
688690
{
689691
struct snd_info_entry *entry;
690692
entry = kzalloc(sizeof(*entry), GFP_KERNEL);
@@ -701,6 +703,7 @@ snd_info_create_entry(const char *name, struct snd_info_entry *parent)
701703
INIT_LIST_HEAD(&entry->children);
702704
INIT_LIST_HEAD(&entry->list);
703705
entry->parent = parent;
706+
entry->module = module;
704707
if (parent)
705708
list_add_tail(&entry->list, &parent->children);
706709
return entry;
@@ -720,14 +723,9 @@ struct snd_info_entry *snd_info_create_module_entry(struct module * module,
720723
const char *name,
721724
struct snd_info_entry *parent)
722725
{
723-
struct snd_info_entry *entry;
724-
725726
if (!parent)
726727
parent = snd_proc_root;
727-
entry = snd_info_create_entry(name, parent);
728-
if (entry)
729-
entry->module = module;
730-
return entry;
728+
return snd_info_create_entry(name, parent, module);
731729
}
732730
EXPORT_SYMBOL(snd_info_create_module_entry);
733731

@@ -745,14 +743,9 @@ struct snd_info_entry *snd_info_create_card_entry(struct snd_card *card,
745743
const char *name,
746744
struct snd_info_entry * parent)
747745
{
748-
struct snd_info_entry *entry;
749-
750746
if (!parent)
751747
parent = card->proc_root;
752-
entry = snd_info_create_entry(name, parent);
753-
if (entry)
754-
entry->module = card->module;
755-
return entry;
748+
return snd_info_create_entry(name, parent, card->module);
756749
}
757750
EXPORT_SYMBOL(snd_info_create_card_entry);
758751

0 commit comments

Comments
 (0)