]> err.no Git - linux-2.6/commitdiff
[ALSA] Remove delayed work properly at free and suspend
authorTakashi Iwai <tiwai@suse.de>
Wed, 31 Jan 2007 13:34:38 +0000 (14:34 +0100)
committerJaroslav Kysela <perex@suse.cz>
Fri, 9 Feb 2007 08:03:28 +0000 (09:03 +0100)
Remove delayed work properly at free and suspend in ac97 codec and
ak4114 drivers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
sound/i2c/other/ak4114.c
sound/pci/ac97/ac97_codec.c

index 34bbafc81cf632b218063062a0d24d902d6e95c2..d2b17c83fd33d8bf71e7830278208e2875d748d9 100644 (file)
@@ -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);
 }
 
index 8b7853c14b5bcddbedfe1fc3d74023705553916b..74ed81081478c1266a8851f6c8709fcdcc90c486 100644 (file)
@@ -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);
 }