Merge branch 'linus' of master.kernel.org:/pub/scm/linux/kernel/git/perex/alsa
[sfrench/cifs-2.6.git] / sound / pci / ac97 / ac97_codec.c
index bd8cfdcfbdf1f24aed53abb5e90d4cc1920220c9..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)
@@ -1190,13 +1191,13 @@ static int snd_ac97_cmute_new_stereo(struct snd_card *card, char *name, int reg,
 /*
  * set dB information
  */
-static DECLARE_TLV_DB_SCALE(db_scale_4bit, -4500, 300, 0);
-static DECLARE_TLV_DB_SCALE(db_scale_5bit, -4650, 150, 0);
-static DECLARE_TLV_DB_SCALE(db_scale_6bit, -9450, 150, 0);
-static DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0);
-static DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0);
+static const DECLARE_TLV_DB_SCALE(db_scale_4bit, -4500, 300, 0);
+static const DECLARE_TLV_DB_SCALE(db_scale_5bit, -4650, 150, 0);
+static const DECLARE_TLV_DB_SCALE(db_scale_6bit, -9450, 150, 0);
+static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0);
+static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0);
 
-static unsigned int *find_db_scale(unsigned int maxval)
+static const unsigned int *find_db_scale(unsigned int maxval)
 {
        switch (maxval) {
        case 0x0f: return db_scale_4bit;
@@ -1206,8 +1207,8 @@ static unsigned int *find_db_scale(unsigned int maxval)
        return NULL;
 }
 
-static void set_tlv_db_scale(struct snd_kcontrol *kctl, unsigned int *tlv)
-{      
+static void set_tlv_db_scale(struct snd_kcontrol *kctl, const unsigned int *tlv)
+{
        kctl->tlv.p = tlv;
        if (tlv)
                kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ;
@@ -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);
 }