diff options
author | Cezary Rojewski <cezary.rojewski@intel.com> | 2025-04-04 13:16:21 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2025-04-07 01:25:11 +0300 |
commit | a3375522bb5e28285cb1845ad5601bf4a581da04 (patch) | |
tree | 1a46a5ec1b91281f2e98d9db57cb60c1f1c26d0e /tools/perf/scripts/python/export-to-postgresql.py | |
parent | d01131e3ce14f9837884aef1f3e463a3a492291f (diff) | |
download | linux-a3375522bb5e28285cb1845ad5601bf4a581da04.tar.xz |
ASoC: core: Complete support for card rebinding
Since commit e894efef9ac7 ("ASoC: core: add support to card rebind")
there is a support for card rebind. The support is only partial though.
Let's consider the following scenarios both of which aim to enumerate a
sound card:
1)
snd_soc_add_component(comp1);
(...)
snd_soc_register_card(card1);
2)
snd_soc_register_card(card1);
(...)
snd_soc_add_component(comp1);
For the sake of simplicity, let comp1 be the last dependency needed for
the card1 to enumerate.
Case 1) will end up succeeding whereas 2) is a certain fail -
snd_soc_bind_card() does not honor unbind_card_list so even a non-fatal
return code of EPROBE_DEFER will cause the card to collapse. Given the
typical usecase of platform_device serving as a card->dev and its
probe() ending with:
int carddev_probe(struct platform_device *pdev)
{
(...)
return devm_snd_soc_register_card(dev, card);
}
failure to register card triggers device_unbind_cleanup() -
really_probe() in dd.c.
To allow for card registration to be deferred while being friendly
towards existing users of devm_snd_soc_register_card(), add new
card->devres_dev field, and devm_xxx() variants for card registration:
devm_snd_soc_register_deferrable_card() (external)
devm_snd_soc_bind_card() (internal)
In essence, if requested, devm_snd_soc_bind_card() replaces
snd_soc_bind_card(). The rebind procedure takes care of destroying
old devres before attempting the new bind. This makes sure nothing is
left hanging if binding fails and card becomes unbound but is still
registered to the ASoC framework.
To allow snd_soc_bind_card() to be reused by the deferrable friends,
move 'client_mutex' locking to the function's callers and select between
devm_xxx and non-devm_xxx variants of snd_soc_bind_card() based on
card->devres_dev.
On top of the feature, the refactoring brings two benefits:
a) single lock/unlock of 'client_mutex' in snd_soc_add_component()
instead of ambiguous unlock and immediate lock in
snd_soc_try_rebind_card()
b) all unbind_card_list manipulations done under 'client_mutex'
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://patch.msgid.link/20250404101622.3673850-1-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/export-to-postgresql.py')
0 files changed, 0 insertions, 0 deletions