diff mbox series

[3/4] ASoC: rt5682-sdw: cancel_work_sync() in .remove and .suspend

Message ID 20210204201739.25206-4-pierre-louis.bossart@linux.intel.com
State Accepted
Commit c792c3690b82c8d26c01494a51ebf66d9cae7e72
Headers show
Series ASoC: codecs: Realtek/SoundWire: fix remove/suspend issues | expand

Commit Message

Pierre-Louis Bossart Feb. 4, 2021, 8:17 p.m. UTC
Follow pattern from other drivers and use cancel_work_sync() for both
.remove() and .suspend().

Fixes: 03f6fc6de919 ('ASoC: rt5682: Add the soundwire support')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@linux.intel.com>
---
 sound/soc/codecs/rt5682-sdw.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/sound/soc/codecs/rt5682-sdw.c b/sound/soc/codecs/rt5682-sdw.c
index 69f046bba67a..b49f1e16125d 100644
--- a/sound/soc/codecs/rt5682-sdw.c
+++ b/sound/soc/codecs/rt5682-sdw.c
@@ -710,7 +710,7 @@  static int rt5682_sdw_remove(struct sdw_slave *slave)
 	struct rt5682_priv *rt5682 = dev_get_drvdata(&slave->dev);
 
 	if (rt5682 && rt5682->hw_init)
-		cancel_delayed_work(&rt5682->jack_detect_work);
+		cancel_delayed_work_sync(&rt5682->jack_detect_work);
 
 	return 0;
 }
@@ -728,6 +728,8 @@  static int __maybe_unused rt5682_dev_suspend(struct device *dev)
 	if (!rt5682->hw_init)
 		return 0;
 
+	cancel_delayed_work_sync(&rt5682->jack_detect_work);
+
 	regcache_cache_only(rt5682->regmap, true);
 	regcache_mark_dirty(rt5682->regmap);