Skip to content

Commit d639e7f

Browse files
morimotobroonie
authored andcommitted
ASoC: hdmi-codec: use RTD ID instead of DAI ID for ELD entry
commit 0ecd24a ("ASoC: hdmi-codec: dump ELD through procfs") adds "eld#%d" entry for sound proc. It is using DAI ID. But it is possible to have duplicate DAI ID on same Sound Card. In such case, we will get below error. To avoid duplicate entry name, use RTD ID instead of DAI ID. proc_dir_entry 'card0/eld#0' already registered WARNING: CPU: 3 PID: 74 at fs/proc/generic.c:377 proc_register+0x11c/0x1a4 Modules linked in: CPU: 3 UID: 0 PID: 74 Comm: kworker/u33:5 Not tainted 6.14.0-rc1-next-20250206-arm64-renesas #174 Hardware name: Renesas Salvator-X 2nd version board based on r8a77951 (DT) Workqueue: events_unbound deferred_probe_work_func pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : proc_register+0x11c/0x1a4 ata1: SATA link down (SStatus 0 SControl 300) lr : proc_register+0x11c/0x1a4 sp : ffff8000847db880 x29: ffff8000847db880 x28: 0000000000000000 x27: ffff0004c3403c98 x26: 0000000000000005 x25: ffff0004c14b03e4 x24: 0000000000000005 x23: ffff0004c361adb8 x22: ffff800082f24860 x21: ffff0004c361ad00 x20: ffff0004c14b0300 x19: ffff0004c14b02c0 x18: 00000000ffffffff x17: 0000000000000000 x16: 00400034b5503510 x15: ffff8001047db447 x14: 0000000000000000 x13: 6465726574736967 x12: ffff800082e66d30 x11: 000000000000028e x10: ffff800082e66d30 x9 : 00000000ffffefff x8 : ffff800082ebed30 x7 : 0000000000017fe8 x6 : 0000000000000000 x5 : 80000000fffff000 x4 : 0000000000000000 x3 : 0000000000000000 x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff0004c15b3600 Call trace: proc_register+0x11c/0x1a4 (P) proc_create_data+0x3c/0x60 snd_info_register+0xd0/0x130 snd_info_register+0x30/0x130 snd_info_card_register+0x1c/0xbc snd_card_register+0x194/0x1ec snd_soc_bind_card+0x7f8/0xad0 snd_soc_register_card+0xe8/0xfc devm_snd_soc_register_card+0x48/0x98 audio_graph_parse_of+0x1c4/0x1f8 graph_probe+0x6c/0x80 ... Fixes: 0ecd24a ("ASoC: hdmi-codec: dump ELD through procfs") Reported-by: Thuan Nguyen <[email protected]> Signed-off-by: Kuninori Morimoto <[email protected]> Tested-by: Thuan Nguyen <[email protected]> Acked-by: Mark Brown <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent f2f8474 commit d639e7f

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

sound/soc/codecs/hdmi-codec.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -842,12 +842,28 @@ static void print_eld_info(struct snd_info_entry *entry,
842842
static int hdmi_dai_proc_new(struct hdmi_codec_priv *hcp,
843843
struct snd_soc_dai *dai)
844844
{
845+
struct snd_soc_component *component = dai->component;
846+
struct snd_soc_card *card = component->card;
847+
struct snd_soc_dai *d;
848+
struct snd_soc_pcm_runtime *rtd;
845849
struct snd_info_entry *entry;
846850
char name[32];
847-
int err;
851+
int err, i, id = 0;
848852

849-
snprintf(name, sizeof(name), "eld#%d", dai->id);
850-
err = snd_card_proc_new(dai->component->card->snd_card, name, &entry);
853+
/*
854+
* To avoid duplicate proc entry, find its rtd and use rtd->id
855+
* instead of dai->id
856+
*/
857+
for_each_card_rtds(card, rtd) {
858+
for_each_rtd_dais(rtd, i, d)
859+
if (d == dai) {
860+
id = rtd->id;
861+
goto found;
862+
}
863+
}
864+
found:
865+
snprintf(name, sizeof(name), "eld#%d", id);
866+
err = snd_card_proc_new(card->snd_card, name, &entry);
851867
if (err < 0)
852868
return err;
853869

0 commit comments

Comments
 (0)