mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
ASoC: hdac_hda: Restore the codec device type on unbind
hdac_hda_codec_probe() changes the type of the codec device to
HDA_DEV_ASOC to prevent snd_hda_codec_unregister() from unregistering
the device when the card is freed.
The type is never restored, and hda_bus_match() requires the device and
driver types to be equal. After unbinding the codec driver via sysfs the
HDA_DEV_LEGACY codec drivers no longer match the device and bind fails
with -ENODEV.
Restore HDA_DEV_LEGACY with a device managed action registered before
the component, so it runs after the component and the card are gone.
Fixes: b60ee2e281 ("ASoC: hdac_hda: overwrite hdev type to HDA_DEV_ASOC")
Cc: stable@vger.kernel.org
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://patch.msgid.link/20261027083840.28813-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
7d357eae97
commit
08a44bde82
|
|
@ -617,6 +617,13 @@ static const struct snd_soc_component_driver hdac_hda_hdmi_codec = {
|
|||
.endianness = 1,
|
||||
};
|
||||
|
||||
static void hdac_hda_restore_dev_type(void *data)
|
||||
{
|
||||
struct hdac_device *hdev = data;
|
||||
|
||||
hdev->type = HDA_DEV_LEGACY;
|
||||
}
|
||||
|
||||
static int hdac_hda_dev_probe(struct hdac_device *hdev)
|
||||
{
|
||||
struct hdac_hda_priv *hda_pvt;
|
||||
|
|
@ -634,6 +641,11 @@ static int hdac_hda_dev_probe(struct hdac_device *hdev)
|
|||
hda_pvt->need_display_power = true;
|
||||
dev_set_drvdata(&hdev->dev, hda_pvt);
|
||||
|
||||
/* Allow the legacy codec driver to match again after unbind */
|
||||
ret = devm_add_action(&hdev->dev, hdac_hda_restore_dev_type, hdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* hold the ref while we probe */
|
||||
hlink = snd_hdac_ext_bus_get_hlink_by_name(hdev->bus, dev_name(&hdev->dev));
|
||||
if (!hlink) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user