ASoC: SOF: simplify snd_sof_device_remove()
authorRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Mon, 7 Mar 2022 18:10:55 +0000 (10:10 -0800)
committerMark Brown <broonie@kernel.org>
Tue, 8 Mar 2022 12:27:40 +0000 (12:27 +0000)
The commit "ASoC: SOF: core: Unregister machine driver before IPC and
debugfs" moved the call to unregister the machine driver to be done
before freeing the IPC. With this change, we can safely move the call to
snd_sof_remove() inside the same if() block just above.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220307181111.49392-3-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/core.c

index 2a35d8ddf43e0baeee578d989c2a9f68b6cccf2c..95a845d26f6efa4c8bd912470368c54d52e8fad3 100644 (file)
@@ -442,16 +442,8 @@ int snd_sof_device_remove(struct device *dev)
 
                snd_sof_ipc_free(sdev);
                snd_sof_free_debug(sdev);
-       }
-
-       /*
-        * Unregistering the machine driver results in unloading the topology.
-        * Some widgets, ex: scheduler, attempt to power down the core they are
-        * scheduled on, when they are unloaded. Therefore, the DSP must be
-        * removed only after the topology has been unloaded.
-        */
-       if (sdev->fw_state > SOF_FW_BOOT_NOT_STARTED)
                snd_sof_remove(sdev);
+       }
 
        /* release firmware */
        snd_sof_fw_unload(sdev);