diff mbox series

[1/2] ASoC: rt700: wait for the delayed work to finish when the system suspends

Message ID 20200921094244.31869-1-shumingf@realtek.com
State Accepted
Commit 5f2df2a4583b0d7b85054f0c1820f11a01936d35
Headers show
Series [1/2] ASoC: rt700: wait for the delayed work to finish when the system suspends | expand

Commit Message

Shuming [θŒƒζ›ΈιŠ˜] Sept. 21, 2020, 9:42 a.m. UTC
From: Shuming Fan <shumingf@realtek.com>

To avoid the IO error, we need to cancel the delayed work and wait for it to finish.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
---
 sound/soc/codecs/rt700-sdw.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Pierre-Louis Bossart Sept. 21, 2020, 2:29 p.m. UTC | #1
On 9/21/20 4:42 AM, shumingf@realtek.com wrote:
> From: Shuming Fan <shumingf@realtek.com>
> 
> To avoid the IO error, we need to cancel the delayed work and wait for it to finish.
> 
> Signed-off-by: Shuming Fan <shumingf@realtek.com>

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

> ---
>   sound/soc/codecs/rt700-sdw.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/sound/soc/codecs/rt700-sdw.c b/sound/soc/codecs/rt700-sdw.c
> index ead4918bbf90..c7deb4e4fcf1 100644
> --- a/sound/soc/codecs/rt700-sdw.c
> +++ b/sound/soc/codecs/rt700-sdw.c
> @@ -490,6 +490,9 @@ static int __maybe_unused rt700_dev_suspend(struct device *dev)
>   	if (!rt700->hw_init)
>   		return 0;
>   
> +	cancel_delayed_work_sync(&rt700->jack_detect_work);
> +	cancel_delayed_work_sync(&rt700->jack_btn_check_work);
> +
>   	regcache_cache_only(rt700->regmap, true);
>   
>   	return 0;
>
diff mbox series

Patch

diff --git a/sound/soc/codecs/rt700-sdw.c b/sound/soc/codecs/rt700-sdw.c
index ead4918bbf90..c7deb4e4fcf1 100644
--- a/sound/soc/codecs/rt700-sdw.c
+++ b/sound/soc/codecs/rt700-sdw.c
@@ -490,6 +490,9 @@  static int __maybe_unused rt700_dev_suspend(struct device *dev)
 	if (!rt700->hw_init)
 		return 0;
 
+	cancel_delayed_work_sync(&rt700->jack_detect_work);
+	cancel_delayed_work_sync(&rt700->jack_btn_check_work);
+
 	regcache_cache_only(rt700->regmap, true);
 
 	return 0;