Commit 5b84ba26 authored by Tejun Heo's avatar Tejun Heo Committed by Takashi Iwai

sound: don't use flush_scheduled_work()

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: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent cf7d7e5a
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment