diff options
author | Takashi Iwai <tiwai@suse.de> | 2019-02-04 15:02:11 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2019-02-06 18:11:54 +0100 |
commit | a8d149813b4456b689effb1f10accdc937566703 (patch) | |
tree | 8d0f924acd27aa26a5bd60d8e542f477e54ad4d8 /sound/core/pcm_memory.c | |
parent | 69fad28cefe33a8d45daef7ef9f5abb69ec2d343 (diff) | |
download | lwn-a8d149813b4456b689effb1f10accdc937566703.tar.gz lwn-a8d149813b4456b689effb1f10accdc937566703.zip |
ALSA: pcm: Remove superfluous snd_info_register() calls
The calls of snd_info_register() are superfluous and should be avoided
at the procfs creation time. They are called at the end of the whole
initialization via snd_card_register(). This patch drops such
superfluous calls, as well as cleaning up the calls of substream proc
entries with a common helper.
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/pcm_memory.c')
-rw-r--r-- | sound/core/pcm_memory.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c index 9a98bc61461f..4012a3a01de1 100644 --- a/sound/core/pcm_memory.c +++ b/sound/core/pcm_memory.c @@ -192,20 +192,19 @@ static inline void preallocate_info_init(struct snd_pcm_substream *substream) { struct snd_info_entry *entry; - if ((entry = snd_info_create_card_entry(substream->pcm->card, "prealloc", substream->proc_root)) != NULL) { - entry->c.text.read = snd_pcm_lib_preallocate_proc_read; + entry = snd_info_create_card_entry(substream->pcm->card, "prealloc", + substream->proc_root); + if (entry) { + snd_info_set_text_ops(entry, substream, + snd_pcm_lib_preallocate_proc_read); entry->c.text.write = snd_pcm_lib_preallocate_proc_write; entry->mode |= 0200; - entry->private_data = substream; - if (snd_info_register(entry) < 0) - snd_info_free_entry(entry); - } - if ((entry = snd_info_create_card_entry(substream->pcm->card, "prealloc_max", substream->proc_root)) != NULL) { - entry->c.text.read = snd_pcm_lib_preallocate_max_proc_read; - entry->private_data = substream; - if (snd_info_register(entry) < 0) - snd_info_free_entry(entry); } + entry = snd_info_create_card_entry(substream->pcm->card, "prealloc_max", + substream->proc_root); + if (entry) + snd_info_set_text_ops(entry, substream, + snd_pcm_lib_preallocate_max_proc_read); } #else /* !CONFIG_SND_VERBOSE_PROCFS */ |