mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:46:16 +00:00
soundwire: intel_init: resume all devices on exit.
When the manager becomes pm_runtime active in the remove procedure, peripherals will become attached, and do the initialization process. We have to wait until all the devices are fully resumed before the cleanup, otherwise there is a possible race condition where asynchronous workqueues initiate transfers on the bus that cannot complete. This will ensure there are no SoundWire registers accessed after the bus is powered-down. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20240410023438.487017-5-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
parent
f2fa686556
commit
4cd5ea6de1
@ -16,6 +16,7 @@
|
|||||||
#include <linux/pm_runtime.h>
|
#include <linux/pm_runtime.h>
|
||||||
#include <linux/soundwire/sdw_intel.h>
|
#include <linux/soundwire/sdw_intel.h>
|
||||||
#include "cadence_master.h"
|
#include "cadence_master.h"
|
||||||
|
#include "bus.h"
|
||||||
#include "intel.h"
|
#include "intel.h"
|
||||||
#include "intel_auxdevice.h"
|
#include "intel_auxdevice.h"
|
||||||
|
|
||||||
@ -356,6 +357,19 @@ EXPORT_SYMBOL_NS(sdw_intel_startup, SOUNDWIRE_INTEL_INIT);
|
|||||||
*/
|
*/
|
||||||
void sdw_intel_exit(struct sdw_intel_ctx *ctx)
|
void sdw_intel_exit(struct sdw_intel_ctx *ctx)
|
||||||
{
|
{
|
||||||
|
struct sdw_intel_link_res *link;
|
||||||
|
|
||||||
|
/* we first resume links and devices and wait synchronously before the cleanup */
|
||||||
|
list_for_each_entry(link, &ctx->link_list, list) {
|
||||||
|
struct sdw_bus *bus = &link->cdns->bus;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = device_for_each_child(bus->dev, NULL, intel_resume_child_device);
|
||||||
|
if (ret < 0)
|
||||||
|
dev_err(bus->dev, "%s: intel_resume_child_device failed: %d\n",
|
||||||
|
__func__, ret);
|
||||||
|
}
|
||||||
|
|
||||||
sdw_intel_cleanup(ctx);
|
sdw_intel_cleanup(ctx);
|
||||||
kfree(ctx->ids);
|
kfree(ctx->ids);
|
||||||
kfree(ctx->ldev);
|
kfree(ctx->ldev);
|
||||||
|
Loading…
Reference in New Issue
Block a user