aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/sound/info.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-04-22 18:26:38 +0200
committerTakashi Iwai <tiwai@suse.de>2015-04-24 17:27:57 +0200
commitc560a6797e3bec1e04f1f6f9f3c2135db0f5c8ee (patch)
tree433dd8c4dd8c53ef7ebe4411f6dbdae7b1e9b74d /include/sound/info.h
parentALSA: core: Fix possible memory leaks at error path in info.c (diff)
downloadwireguard-linux-c560a6797e3bec1e04f1f6f9f3c2135db0f5c8ee.tar.xz
wireguard-linux-c560a6797e3bec1e04f1f6f9f3c2135db0f5c8ee.zip
ALSA: core: Remove child proc file elements recursively
This patch changes the way to manage the resource release of proc files: namely, let snd_info_free_entry() freeing the whole children. This makes it us possible to drop the snd_device_*() management. Then snd_card_proc_new() becomes merely a wrapper to snd_info_create_card_entry(). Together with this change, now you need to call snd_info_free_entry() for a proc entry created via snd_card_proc_new(), while it was freed via snd_device_free() beforehand. Acked-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/sound/info.h')
-rw-r--r--include/sound/info.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/sound/info.h b/include/sound/info.h
index ff8962ebece5..3e2fda3c75ee 100644
--- a/include/sound/info.h
+++ b/include/sound/info.h
@@ -24,6 +24,7 @@
#include <linux/poll.h>
#include <linux/seq_file.h>
+#include <sound/core.h>
/* buffer for information */
struct snd_info_buffer {
@@ -146,8 +147,12 @@ void snd_info_card_id_change(struct snd_card *card);
int snd_info_register(struct snd_info_entry *entry);
/* for card drivers */
-int snd_card_proc_new(struct snd_card *card, const char *name,
- struct snd_info_entry **entryp);
+static inline int snd_card_proc_new(struct snd_card *card, const char *name,
+ struct snd_info_entry **entryp)
+{
+ *entryp = snd_info_create_card_entry(card, name, card->proc_root);
+ return *entryp ? 0 : -ENOMEM;
+}
static inline void snd_info_set_text_ops(struct snd_info_entry *entry,
void *private_data,