From 29b2625ff605394ecd0b078e0cb67a151bb4d80c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 5 Feb 2019 16:26:06 +0100 Subject: 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 Signed-off-by: Takashi Iwai --- sound/core/info.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'sound/core/info.c') 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); } /* -- cgit v1.2.3-58-ga151