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>
This commit is contained in:
Takashi Iwai
2019-02-05 16:26:06 +01:00
parent a858ee6655
commit 29b2625ff6
3 changed files with 14 additions and 31 deletions

View File

@@ -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);
}
/*