summaryrefslogtreecommitdiff
path: root/sound/core/info.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-02-05 16:26:06 +0100
committerTakashi Iwai <tiwai@suse.de>2019-02-06 18:11:58 +0100
commit29b2625ff605394ecd0b078e0cb67a151bb4d80c (patch)
treebf328cc3530de4277039d263546a07be20ce112c /sound/core/info.c
parenta858ee6655ca2f0fc6e2e5d426446bd898c92272 (diff)
ALSA: info: Move card id proc creation into info.c
The creation of card's id proc file can be moved gracefully into info.c. Also, the assignment of card->proc_id is superfluous and can be dropped. So let's do it. Basically this is no functional change but code refactoring, but one potential behavior change is that now it returns properly the error code from snd_info_card_register(), which is a good thing (tm). Reviewed-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/info.c')
-rw-r--r--sound/core/info.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sound/core/info.c b/sound/core/info.c
index 7a4e733172ee..96a074019c33 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -504,6 +504,14 @@ int __exit snd_info_done(void)
return 0;
}
+static void snd_card_id_read(struct snd_info_entry *entry,
+ struct snd_info_buffer *buffer)
+{
+ struct snd_card *card = entry->private_data;
+
+ snd_iprintf(buffer, "%s\n", card->id);
+}
+
/*
* create a card proc file
* called from init.c
@@ -521,7 +529,8 @@ int snd_info_card_create(struct snd_card *card)
if (!entry)
return -ENOMEM;
card->proc_root = entry;
- return 0;
+
+ return snd_card_ro_proc_new(card, "id", card, snd_card_id_read);
}
/*