sound: don't use flush_scheduled_work()
authorTejun Heo <tj@kernel.org>
Sat, 11 Dec 2010 16:51:26 +0000 (17:51 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 13 Dec 2010 08:22:44 +0000 (09:22 +0100)
flush_scheduled_work() is deprecated and scheduled to be removed.

* cancel[_delayed]_work() + flush_scheduled_work() ->
  cancel[_delayed]_work_sync().

* wm8350, wm8753 and soc-core use custom code to cancel a delayed
  work, execute it immediately if it was pending and wait for its
  completion.  This is equivalent to flush_delayed_work_sync().  Use
  it instead.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/aoa/core/gpio-feature.c
sound/aoa/core/gpio-pmf.c
sound/i2c/other/ak4113.c
sound/i2c/other/ak4114.c
sound/pci/ac97/ac97_codec.c
sound/pci/hda/patch_via.c
sound/pci/oxygen/oxygen_lib.c
sound/soc/codecs/wm8350.c
sound/soc/codecs/wm8753.c
sound/soc/soc-core.c

index de8e03afa97b2e09d8602be884a56f252dcf3069..faa3174905458d85ece1bee693d27db95b789746 100644 (file)
@@ -287,10 +287,9 @@ static void ftr_gpio_exit(struct gpio_runtime *rt)
                free_irq(linein_detect_irq, &rt->line_in_notify);
        if (rt->line_out_notify.gpio_private)
                free_irq(lineout_detect_irq, &rt->line_out_notify);
-       cancel_delayed_work(&rt->headphone_notify.work);
-       cancel_delayed_work(&rt->line_in_notify.work);
-       cancel_delayed_work(&rt->line_out_notify.work);
-       flush_scheduled_work();
+       cancel_delayed_work_sync(&rt->headphone_notify.work);
+       cancel_delayed_work_sync(&rt->line_in_notify.work);
+       cancel_delayed_work_sync(&rt->line_out_notify.work);
        mutex_destroy(&rt->headphone_notify.mutex);
        mutex_destroy(&rt->line_in_notify.mutex);
        mutex_destroy(&rt->line_out_notify.mutex);
index 7e267c9379bc18dac80998b95701a77068aaa85d..c8d8a1a6f9646d77961c92da2178806b555267b9 100644 (file)
@@ -107,10 +107,9 @@ static void pmf_gpio_exit(struct gpio_runtime *rt)
 
        /* make sure no work is pending before freeing
         * all things */
-       cancel_delayed_work(&rt->headphone_notify.work);
-       cancel_delayed_work(&rt->line_in_notify.work);
-       cancel_delayed_work(&rt->line_out_notify.work);
-       flush_scheduled_work();
+       cancel_delayed_work_sync(&rt->headphone_notify.work);
+       cancel_delayed_work_sync(&rt->line_in_notify.work);
+       cancel_delayed_work_sync(&rt->line_out_notify.work);
 
        mutex_destroy(&rt->headphone_notify.mutex);
        mutex_destroy(&rt->line_in_notify.mutex);
index 971a84a4fa77692336ab6e520adc651afe721b32..c424d329f806dbba3d32d0958fd4450d5042b88f 100644 (file)
@@ -57,8 +57,7 @@ static void snd_ak4113_free(struct ak4113 *chip)
 {
        chip->init = 1; /* don't schedule new work */
        mb();
-       cancel_delayed_work(&chip->work);
-       flush_scheduled_work();
+       cancel_delayed_work_sync(&chip->work);
        kfree(chip);
 }
 
@@ -141,7 +140,7 @@ void snd_ak4113_reinit(struct ak4113 *chip)
 {
        chip->init = 1;
        mb();
-       flush_scheduled_work();
+       flush_delayed_work_sync(&chip->work);
        ak4113_init_regs(chip);
        /* bring up statistics / event queing */
        chip->init = 0;
index 0341451f814c3bfdd3f788776cfe722d833afe54..d9fb537b0b947bb1a44f52d06f6ac80a97d75f99 100644 (file)
@@ -67,8 +67,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();
+       cancel_delayed_work_sync(&chip->work);
        kfree(chip);
 }
 
@@ -154,7 +153,7 @@ void snd_ak4114_reinit(struct ak4114 *chip)
 {
        chip->init = 1;
        mb();
-       flush_scheduled_work();
+       flush_delayed_work_sync(&chip->work);
        ak4114_init_regs(chip);
        /* bring up statistics / event queing */
        chip->init = 0;
index a7630e9edf8a0e802b32747b3c6fa8a3999af93e..0fc614ce16c1fe196f6c1b7913dd1179afb03f00 100644 (file)
@@ -1014,8 +1014,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();
+               cancel_delayed_work_sync(&ac97->power_work);
 #endif
                snd_ac97_proc_done(ac97);
                if (ac97->bus)
@@ -2456,8 +2455,7 @@ void snd_ac97_suspend(struct snd_ac97 *ac97)
        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();
+       cancel_delayed_work_sync(&ac97->power_work);
 #endif
        snd_ac97_powerdown(ac97);
 }
index d1c3f8defc48d059f42124542d4e09b1fda000cf..7f4852a478a11ab0f56b545416c57c0208a8cc2c 100644 (file)
@@ -263,8 +263,7 @@ static void vt1708_stop_hp_work(struct via_spec *spec)
                return;
        snd_hda_codec_write(spec->codec, 0x1, 0, 0xf81,
                            !spec->vt1708_jack_detectect);
-       cancel_delayed_work(&spec->vt1708_hp_work);
-       flush_scheduled_work();
+       cancel_delayed_work_sync(&spec->vt1708_hp_work);
 }
 
 
index e5ebe56fb0c5c5129206f5fa4be6fcfc99e8888c..969605fbcb7f2727c6bee934635f83c875e44857 100644 (file)
@@ -557,7 +557,8 @@ static void oxygen_card_free(struct snd_card *card)
        oxygen_shutdown(chip);
        if (chip->irq >= 0)
                free_irq(chip->irq, chip);
-       flush_scheduled_work();
+       flush_work_sync(&chip->spdif_input_bits_work);
+       flush_work_sync(&chip->gpio_work);
        chip->model.cleanup(chip);
        kfree(chip->model_data);
        mutex_destroy(&chip->mutex);
@@ -733,7 +734,8 @@ int oxygen_pci_suspend(struct pci_dev *pci, pm_message_t state)
        spin_unlock_irq(&chip->reg_lock);
 
        synchronize_irq(chip->irq);
-       flush_scheduled_work();
+       flush_work_sync(&chip->spdif_input_bits_work);
+       flush_work_sync(&chip->gpio_work);
        chip->interrupt_mask = saved_interrupt_mask;
 
        pci_disable_device(pci);
index 7611add7f8c38751806684a521d891ede746197f..b3e9fac172e5d23edba30fb83e6caa522696b82e 100644 (file)
@@ -1626,7 +1626,6 @@ static int  wm8350_codec_remove(struct snd_soc_codec *codec)
 {
        struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
        struct wm8350 *wm8350 = dev_get_platdata(codec->dev);
-       int ret;
 
        wm8350_clear_bits(wm8350, WM8350_JACK_DETECT,
                          WM8350_JDL_ENA | WM8350_JDR_ENA);
@@ -1641,15 +1640,9 @@ static int  wm8350_codec_remove(struct snd_soc_codec *codec)
        priv->hpr.jack = NULL;
        priv->mic.jack = NULL;
 
-       /* cancel any work waiting to be queued. */
-       ret = cancel_delayed_work(&codec->delayed_work);
-
        /* if there was any work waiting then we run it now and
         * wait for its completion */
-       if (ret) {
-               schedule_delayed_work(&codec->delayed_work, 0);
-               flush_scheduled_work();
-       }
+       flush_delayed_work_sync(&codec->delayed_work);
 
        wm8350_set_bias_level(codec, SND_SOC_BIAS_OFF);
 
index 8f679a13f2bcaae23653adaffafff6fedcd8e66f..84a23675cba929d56f5bfda9a8d9f269a7c44bd6 100644 (file)
@@ -1526,25 +1526,6 @@ static int wm8753_resume(struct snd_soc_codec *codec)
        return 0;
 }
 
-/*
- * This function forces any delayed work to be queued and run.
- */
-static int run_delayed_work(struct delayed_work *dwork)
-{
-       int ret;
-
-       /* cancel any work waiting to be queued. */
-       ret = cancel_delayed_work(dwork);
-
-       /* if there was any work waiting then we run it now and
-        * wait for it's completion */
-       if (ret) {
-               schedule_delayed_work(dwork, 0);
-               flush_scheduled_work();
-       }
-       return ret;
-}
-
 static int wm8753_probe(struct snd_soc_codec *codec)
 {
        struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
@@ -1604,7 +1585,7 @@ static int wm8753_probe(struct snd_soc_codec *codec)
 /* power down chip */
 static int wm8753_remove(struct snd_soc_codec *codec)
 {
-       run_delayed_work(&codec->delayed_work);
+       flush_delayed_work_sync(&codec->delayed_work);
        wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF);
 
        return 0;
index 441285ade024ff33589cd22204ef5cb82a1f14ea..b54ea9a0a1db4af6d1b66254416af147efb9a446 100644 (file)
@@ -67,25 +67,6 @@ static int pmdown_time = 5000;
 module_param(pmdown_time, int, 0);
 MODULE_PARM_DESC(pmdown_time, "DAPM stream powerdown time (msecs)");
 
-/*
- * This function forces any delayed work to be queued and run.
- */
-static int run_delayed_work(struct delayed_work *dwork)
-{
-       int ret;
-
-       /* cancel any work waiting to be queued. */
-       ret = cancel_delayed_work(dwork);
-
-       /* if there was any work waiting then we run it now and
-        * wait for it's completion */
-       if (ret) {
-               schedule_delayed_work(dwork, 0);
-               flush_scheduled_work();
-       }
-       return ret;
-}
-
 /* codec register dump */
 static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf)
 {
@@ -1016,7 +997,7 @@ static int soc_suspend(struct device *dev)
 
        /* close any waiting streams and save state */
        for (i = 0; i < card->num_rtd; i++) {
-               run_delayed_work(&card->rtd[i].delayed_work);
+               flush_delayed_work_sync(&card->rtd[i].delayed_work);
                card->rtd[i].codec->suspend_bias_level = card->rtd[i].codec->bias_level;
        }
 
@@ -1687,7 +1668,7 @@ static int soc_remove(struct platform_device *pdev)
                /* make sure any delayed work runs */
                for (i = 0; i < card->num_rtd; i++) {
                        struct snd_soc_pcm_runtime *rtd = &card->rtd[i];
-                       run_delayed_work(&rtd->delayed_work);
+                       flush_delayed_work_sync(&rtd->delayed_work);
                }
 
                /* remove and free each DAI */
@@ -1718,7 +1699,7 @@ static int soc_poweroff(struct device *dev)
         * now, we're shutting down so no imminent restart. */
        for (i = 0; i < card->num_rtd; i++) {
                struct snd_soc_pcm_runtime *rtd = &card->rtd[i];
-               run_delayed_work(&rtd->delayed_work);
+               flush_delayed_work_sync(&rtd->delayed_work);
        }
 
        snd_soc_dapm_shutdown(card);