From: Shuming Fan Date: Mon, 21 Sep 2020 09:43:08 +0000 (+0800) Subject: ASoC: rt711: wait for the delayed work to finish when the system suspends X-Git-Tag: io_uring-5.10-2020-10-20~47^2~1^2~1^2~9 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=501ef013390b774e8e61000a78d1d640d6c3411d;p=linux-block.git ASoC: rt711: wait for the delayed work to finish when the system suspends To avoid the IO error, we need to cancel the delayed work and wait for it to finish. Signed-off-by: Shuming Fan Reviewed-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20200921094308.31921-1-shumingf@realtek.com Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/rt711-sdw.c b/sound/soc/codecs/rt711-sdw.c index 7efff130a638..9eabd30521c7 100644 --- a/sound/soc/codecs/rt711-sdw.c +++ b/sound/soc/codecs/rt711-sdw.c @@ -491,6 +491,10 @@ static int __maybe_unused rt711_dev_suspend(struct device *dev) if (!rt711->hw_init) return 0; + cancel_delayed_work_sync(&rt711->jack_detect_work); + cancel_delayed_work_sync(&rt711->jack_btn_check_work); + cancel_work_sync(&rt711->calibration_work); + regcache_cache_only(rt711->regmap, true); return 0;