From: Takashi Iwai Date: Wed, 31 Jan 2007 13:34:38 +0000 (+0100) Subject: [ALSA] Remove delayed work properly at free and suspend X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3b6baa5a0b0a2877c18a76fa1f508cacdbc08edf;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [ALSA] Remove delayed work properly at free and suspend Remove delayed work properly at free and suspend in ac97 codec and ak4114 drivers. Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c index 34bbafc81cf6..d2b17c83fd33 100644 --- a/sound/i2c/other/ak4114.c +++ b/sound/i2c/other/ak4114.c @@ -66,6 +66,7 @@ static void snd_ak4114_free(struct ak4114 *chip) { chip->init = 1; /* don't schedule new work */ mb(); + cancel_delayed_work(&chip->work); flush_scheduled_work(); kfree(chip); } @@ -97,6 +98,7 @@ int snd_ak4114_create(struct snd_card *card, chip->read = read; chip->write = write; chip->private_data = private_data; + INIT_DELAYED_WORK(&chip->work, ak4114_stats); for (reg = 0; reg < 7; reg++) chip->regmap[reg] = pgm[reg]; @@ -149,7 +151,6 @@ void snd_ak4114_reinit(struct ak4114 *chip) reg_write(chip, AK4114_REG_PWRDN, old | AK4114_RST | AK4114_PWN); /* bring up statistics / event queing */ chip->init = 0; - INIT_DELAYED_WORK(&chip->work, ak4114_stats); schedule_delayed_work(&chip->work, HZ / 10); } diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 8b7853c14b5b..74ed81081478 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -990,6 +990,7 @@ static int snd_ac97_free(struct snd_ac97 *ac97) if (ac97) { #ifdef CONFIG_SND_AC97_POWER_SAVE cancel_delayed_work(&ac97->power_work); + flush_scheduled_work(); #endif snd_ac97_proc_done(ac97); if (ac97->bus) @@ -2415,6 +2416,10 @@ void snd_ac97_suspend(struct snd_ac97 *ac97) return; if (ac97->build_ops->suspend) ac97->build_ops->suspend(ac97); +#ifdef CONFIG_SND_AC97_POWER_SAVE + cancel_delayed_work(&ac97->power_work); + flush_scheduled_work(); +#endif snd_ac97_powerdown(ac97); }