replace SNDMSG,SYSMSG,SNDERR,SYSERR with new log macros

... with interface identifiers

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2025-11-06 15:57:13 +01:00
parent 492df4bb94
commit 62c8e635dc
82 changed files with 1292 additions and 1201 deletions

View file

@ -115,8 +115,9 @@ static int build_pcm(snd_tplg_t *tplg, struct tplg_elem *elem)
return err;
}
if (!ref->elem) {
SNDERR("cannot find '%s' referenced by"
" PCM '%s'", ref->id, elem->id);
snd_error(TOPOLOGY, "cannot find '%s' referenced by"
" PCM '%s'", ref->id, elem->id);
return -EINVAL;
}
}
@ -136,7 +137,7 @@ int tplg_build_pcms(snd_tplg_t *tplg, unsigned int type)
elem = list_entry(pos, struct tplg_elem, list);
if (elem->type != type) {
SNDERR("invalid elem '%s'", elem->id);
snd_error(TOPOLOGY, "invalid elem '%s'", elem->id);
return -EINVAL;
}
@ -195,7 +196,7 @@ int tplg_build_dais(snd_tplg_t *tplg, unsigned int type)
elem = list_entry(pos, struct tplg_elem, list);
if (elem->type != type) {
SNDERR("invalid elem '%s'", elem->id);
snd_error(TOPOLOGY, "invalid elem '%s'", elem->id);
return -EINVAL;
}
@ -250,9 +251,10 @@ static int build_link(snd_tplg_t *tplg, struct tplg_elem *elem)
ref->elem = tplg_elem_lookup(&tplg->hw_cfg_list,
ref->id, SND_TPLG_TYPE_HW_CONFIG, elem->index);
if (!ref->elem) {
SNDERR("cannot find HW config '%s'"
" referenced by link '%s'",
ref->id, elem->id);
snd_error(TOPOLOGY, "cannot find HW config '%s'"
" referenced by link '%s'",
ref->id, elem->id);
return -EINVAL;
}
@ -320,7 +322,7 @@ static int split_format(struct snd_soc_tplg_stream_caps *caps, char *str)
while ((s != NULL) && (i < SND_SOC_TPLG_MAX_FORMATS)) {
format = snd_pcm_format_value(s);
if (format == SND_PCM_FORMAT_UNKNOWN) {
SNDERR("unsupported stream format %s", s);
snd_error(TOPOLOGY, "unsupported stream format %s", s);
return -EINVAL;
}
@ -363,7 +365,7 @@ static int split_rate(struct snd_soc_tplg_stream_caps *caps, char *str)
rate = get_rate_value(s);
if (rate == SND_PCM_RATE_UNKNOWN) {
SNDERR("unsupported stream rate %s", s);
snd_error(TOPOLOGY, "unsupported stream rate %s", s);
return -EINVAL;
}
@ -762,7 +764,7 @@ static int tplg_parse_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
if (strcmp(id, "id") == 0) {
if (tplg_get_unsigned(n, &dai_id, 0)) {
SNDERR("invalid fe dai ID");
snd_error(TOPOLOGY, "invalid fe dai ID");
return -EINVAL;
}
@ -1413,7 +1415,7 @@ static int get_audio_hw_format(const char *val)
if (strcasecmp(audio_hw_formats[i].name, val) == 0)
return audio_hw_formats[i].type;
SNDERR("invalid audio HW format %s", val);
snd_error(TOPOLOGY, "invalid audio HW format %s", val);
return -EINVAL;
}
@ -1480,7 +1482,7 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
provider_legacy = false;
if (strcmp(id, "bclk_master") == 0) {
SNDERR("deprecated option %s, please use 'bclk'", id);
snd_error(TOPOLOGY, "deprecated option %s, please use 'bclk'", id);
provider_legacy = true;
}
@ -1494,17 +1496,17 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
/* For backwards capability,
* "master" == "codec is slave"
*/
SNDERR("deprecated bclk value '%s'", val);
snd_error(TOPOLOGY, "deprecated bclk value '%s'", val);
hw_cfg->bclk_provider = SND_SOC_TPLG_BCLK_CC;
} else if (!strcmp(val, "codec_slave")) {
SNDERR("deprecated bclk value '%s', use 'codec_consumer'", val);
snd_error(TOPOLOGY, "deprecated bclk value '%s', use 'codec_consumer'", val);
hw_cfg->bclk_provider = SND_SOC_TPLG_BCLK_CC;
} else if (!strcmp(val, "codec_consumer")) {
hw_cfg->bclk_provider = SND_SOC_TPLG_BCLK_CC;
} else if (!strcmp(val, "codec_master")) {
SNDERR("deprecated bclk value '%s', use 'codec_provider", val);
snd_error(TOPOLOGY, "deprecated bclk value '%s', use 'codec_provider", val);
hw_cfg->bclk_provider = SND_SOC_TPLG_BCLK_CP;
} else if (!strcmp(val, "codec_provider")) {
@ -1532,7 +1534,7 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
provider_legacy = false;
if (strcmp(id, "fsync_master") == 0) {
SNDERR("deprecated option %s, please use 'fsync'", id);
snd_error(TOPOLOGY, "deprecated option %s, please use 'fsync'", id);
provider_legacy = true;
}
@ -1546,17 +1548,17 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
/* For backwards capability,
* "master" == "codec is slave"
*/
SNDERR("deprecated fsync value '%s'", val);
snd_error(TOPOLOGY, "deprecated fsync value '%s'", val);
hw_cfg->fsync_provider = SND_SOC_TPLG_FSYNC_CC;
} else if (!strcmp(val, "codec_slave")) {
SNDERR("deprecated fsync value '%s', use 'codec_consumer'", val);
snd_error(TOPOLOGY, "deprecated fsync value '%s', use 'codec_consumer'", val);
hw_cfg->fsync_provider = SND_SOC_TPLG_FSYNC_CC;
} else if (!strcmp(val, "codec_consumer")) {
hw_cfg->fsync_provider = SND_SOC_TPLG_FSYNC_CC;
} else if (!strcmp(val, "codec_master")) {
SNDERR("deprecated fsync value '%s', use 'codec_provider'", val);
snd_error(TOPOLOGY, "deprecated fsync value '%s', use 'codec_provider'", val);
hw_cfg->fsync_provider = SND_SOC_TPLG_FSYNC_CP;
} else if (!strcmp(val, "codec_provider")) {
@ -1598,7 +1600,7 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
/* For backwards capability,
* "master" == "for codec, mclk is input"
*/
SNDERR("deprecated mclk value '%s'", val);
snd_error(TOPOLOGY, "deprecated mclk value '%s'", val);
hw_cfg->mclk_direction = SND_SOC_TPLG_MCLK_CI;
} else if (!strcmp(val, "codec_mclk_in")) {
@ -2016,20 +2018,21 @@ next:
pcm = bin;
if (size < sizeof(*pcm)) {
SNDERR("pcm: small size %d", size);
snd_error(TOPOLOGY, "pcm: small size %d", size);
return -EINVAL;
}
if (sizeof(*pcm) != pcm->size) {
SNDERR("pcm: unknown element size %d (expected %zd)",
pcm->size, sizeof(*pcm));
snd_error(TOPOLOGY, "pcm: unknown element size %d (expected %zd)",
pcm->size, sizeof(*pcm));
return -EINVAL;
}
if (pcm->num_streams > SND_SOC_TPLG_STREAM_CONFIG_MAX) {
SNDERR("pcm: wrong number of streams %d", pcm->num_streams);
snd_error(TOPOLOGY, "pcm: wrong number of streams %d", pcm->num_streams);
return -EINVAL;
}
if (sizeof(*pcm) + pcm->priv.size > size) {
SNDERR("pcm: wrong private data size %d", pcm->priv.size);
snd_error(TOPOLOGY, "pcm: wrong private data size %d", pcm->priv.size);
return -EINVAL;
}
@ -2054,8 +2057,9 @@ next:
for (i = 0; i < pcm->num_streams; i++) {
stream = &pt->stream[i];
if (pcm->stream[i].size != sizeof(pcm->stream[0])) {
SNDERR("pcm: unknown stream structure size %d",
pcm->stream[i].size);
snd_error(TOPOLOGY, "pcm: unknown stream structure size %d",
pcm->stream[i].size);
return -EINVAL;
}
stream->name = pcm->stream[i].name;
@ -2075,8 +2079,9 @@ next:
cap = &caps[i];
pt->caps[i] = cap;
if (pcm->caps[i].size != sizeof(pcm->caps[0])) {
SNDERR("pcm: unknown caps structure size %d",
pcm->caps[i].size);
snd_error(TOPOLOGY, "pcm: unknown caps structure size %d",
pcm->caps[i].size);
return -EINVAL;
}
cap->name = pcm->caps[i].name;
@ -2123,7 +2128,7 @@ int tplg_decode_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
void *bin ATTRIBUTE_UNUSED,
size_t size ATTRIBUTE_UNUSED)
{
SNDERR("not implemented");
snd_error(TOPOLOGY, "not implemented");
return -ENXIO;
}
@ -2134,7 +2139,7 @@ int tplg_decode_cc(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
void *bin ATTRIBUTE_UNUSED,
size_t size ATTRIBUTE_UNUSED)
{
SNDERR("not implemented");
snd_error(TOPOLOGY, "not implemented");
return -ENXIO;
}
@ -2165,24 +2170,25 @@ next:
link = bin;
if (size < sizeof(*link)) {
SNDERR("link: small size %d", size);
snd_error(TOPOLOGY, "link: small size %d", size);
return -EINVAL;
}
if (sizeof(*link) != link->size) {
SNDERR("link: unknown element size %d (expected %zd)",
link->size, sizeof(*link));
snd_error(TOPOLOGY, "link: unknown element size %d (expected %zd)",
link->size, sizeof(*link));
return -EINVAL;
}
if (link->num_streams > SND_SOC_TPLG_STREAM_CONFIG_MAX) {
SNDERR("link: wrong number of streams %d", link->num_streams);
snd_error(TOPOLOGY, "link: wrong number of streams %d", link->num_streams);
return -EINVAL;
}
if (link->num_hw_configs > SND_SOC_TPLG_HW_CONFIG_MAX) {
SNDERR("link: wrong number of streams %d", link->num_streams);
snd_error(TOPOLOGY, "link: wrong number of streams %d", link->num_streams);
return -EINVAL;
}
if (sizeof(*link) + link->priv.size > size) {
SNDERR("link: wrong private data size %d", link->priv.size);
snd_error(TOPOLOGY, "link: wrong private data size %d", link->priv.size);
return -EINVAL;
}
@ -2204,8 +2210,9 @@ next:
for (i = 0; i < link->num_streams; i++) {
stream = &streams[i];
if (link->stream[i].size != sizeof(link->stream[0])) {
SNDERR("link: unknown stream structure size %d",
link->stream[i].size);
snd_error(TOPOLOGY, "link: unknown stream structure size %d",
link->stream[i].size);
return -EINVAL;
}
stream->name = link->stream[i].name;
@ -2222,8 +2229,9 @@ next:
for (i = 0; i < link->num_hw_configs; i++) {
hw = &hws[i];
if (link->hw_config[i].size != sizeof(link->hw_config[0])) {
SNDERR("link: unknown hw_config structure size %d",
link->hw_config[i].size);
snd_error(TOPOLOGY, "link: unknown hw_config structure size %d",
link->hw_config[i].size);
return -EINVAL;
}
hw->id = link->hw_config[i].id;
@ -2243,14 +2251,14 @@ next:
hw->rx_slots = link->hw_config[i].rx_slots;
hw->tx_channels = link->hw_config[i].tx_channels;
if (hw->tx_channels > SND_SOC_TPLG_MAX_CHAN) {
SNDERR("link: wrong tx channels %d", hw->tx_channels);
snd_error(TOPOLOGY, "link: wrong tx channels %d", hw->tx_channels);
return -EINVAL;
}
for (j = 0; j < hw->tx_channels; j++)
hw->tx_chanmap[j] = link->hw_config[i].tx_chanmap[j];
hw->rx_channels = link->hw_config[i].rx_channels;
if (hw->rx_channels > SND_SOC_TPLG_MAX_CHAN) {
SNDERR("link: wrong rx channels %d", hw->tx_channels);
snd_error(TOPOLOGY, "link: wrong rx channels %d", hw->tx_channels);
return -EINVAL;
}
for (j = 0; j < hw->rx_channels; j++)