Skip to content

Commit ce4ed6c

Browse files
committed
ASoC: sdw_utils: return -EPROBE_DEFER if components are not registered yet
commit 42d9985 ("ASoC: core: Move all users to deferrable card binding") converted the -EPROBE_DEFER return value of snd_soc_bind_card() to 0 which results in the machine driver probe return 0 and will not be called again when any component is not yet registered. We get the right component name from the registered components and use it in the dai links. It will lead to bind fail if the default component name is used. Return -EPROBE_DEFER to allow the machine driver probe again after the components are registered. Suggested-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
1 parent fcdd87e commit ce4ed6c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

sound/soc/sdw_utils/soc_sdw_utils.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,7 +1629,9 @@ const char *asoc_sdw_get_codec_name(struct device *dev,
16291629
__func__, component->name, dai_info->codec_name);
16301630
return devm_kstrdup(dev, component->name, GFP_KERNEL);
16311631
} else {
1632-
return devm_kstrdup(dev, dai_info->codec_name, GFP_KERNEL);
1632+
dev_dbg(dev, "%s component %s is not registered yet\n",
1633+
__func__, dai_info->codec_name);
1634+
return ERR_PTR(-EPROBE_DEFER);
16331635
}
16341636
}
16351637

@@ -2021,7 +2023,9 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card,
20212023
codec_info->auxs[j].codec_name);
20222024
soc_aux->dlc.name = component->name;
20232025
} else {
2024-
soc_aux->dlc.name = codec_info->auxs[j].codec_name;
2026+
dev_dbg(dev, "%s the aux component %s is not registered yet\n",
2027+
__func__, codec_info->auxs[j].codec_name);
2028+
return -EPROBE_DEFER;
20252029
}
20262030
soc_aux++;
20272031
}
@@ -2121,6 +2125,8 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card,
21212125

21222126
codec_name = asoc_sdw_get_codec_name(dev, dai_info,
21232127
adr_link, i);
2128+
if (IS_ERR(codec_name))
2129+
return PTR_ERR(codec_name);
21242130
if (!codec_name)
21252131
return -ENOMEM;
21262132

0 commit comments

Comments
 (0)