aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-12-11 11:51:26 -0500
committerTakashi Iwai <tiwai@suse.de>2010-12-13 03:22:44 -0500
commit5b84ba26a9672e615897234fa5efd3eea2d6b295 (patch)
tree1d86d5179cefecc986b6c7be0550050c29418869
parentcf7d7e5a1980d1116ee152d25dac382b112b9c17 (diff)
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: Tejun Heo <tj@kernel.org> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/aoa/core/gpio-feature.c7
-rw-r--r--sound/aoa/core/gpio-pmf.c7
-rw-r--r--sound/i2c/other/ak4113.c5
-rw-r--r--sound/i2c/other/ak4114.c5
-rw-r--r--sound/pci/ac97/ac97_codec.c6
-rw-r--r--sound/pci/hda/patch_via.c3
-rw-r--r--sound/pci/oxygen/oxygen_lib.c6
-rw-r--r--sound/soc/codecs/wm8350.c9
-rw-r--r--sound/soc/codecs/wm8753.c21
-rw-r--r--sound/soc/soc-core.c25
10 files changed, 22 insertions, 72 deletions
diff --git a/sound/aoa/core/gpio-feature.c b/sound/aoa/core/gpio-feature.c
index de8e03afa97b..faa317490545 100644
--- a/sound/aoa/core/gpio-feature.c
+++ b/sound/aoa/core/gpio-feature.c
@@ -287,10 +287,9 @@ static void ftr_gpio_exit(struct gpio_runtime *rt)
287 free_irq(linein_detect_irq, &rt->line_in_notify); 287 free_irq(linein_detect_irq, &rt->line_in_notify);
288 if (rt->line_out_notify.gpio_private) 288 if (rt->line_out_notify.gpio_private)
289 free_irq(lineout_detect_irq, &rt->line_out_notify); 289 free_irq(lineout_detect_irq, &rt->line_out_notify);
290 cancel_delayed_work(&rt->headphone_notify.work); 290 cancel_delayed_work_sync(&rt->headphone_notify.work);
291 cancel_delayed_work(&rt->line_in_notify.work); 291 cancel_delayed_work_sync(&rt->line_in_notify.work);
292 cancel_delayed_work(&rt->line_out_notify.work); 292 cancel_delayed_work_sync(&rt->line_out_notify.work);
293 flush_scheduled_work();
294 mutex_destroy(&rt->headphone_notify.mutex); 293 mutex_destroy(&rt->headphone_notify.mutex);
295 mutex_destroy(&rt->line_in_notify.mutex); 294 mutex_destroy(&rt->line_in_notify.mutex);
296 mutex_destroy(&rt->line_out_notify.mutex); 295 mutex_destroy(&rt->line_out_notify.mutex);
diff --git a/sound/aoa/core/gpio-pmf.c b/sound/aoa/core/gpio-pmf.c
index 7e267c9379bc..c8d8a1a6f964 100644
--- a/sound/aoa/core/gpio-pmf.c
+++ b/sound/aoa/core/gpio-pmf.c
@@ -107,10 +107,9 @@ static void pmf_gpio_exit(struct gpio_runtime *rt)
107 107
108 /* make sure no work is pending before freeing 108 /* make sure no work is pending before freeing
109 * all things */ 109 * all things */
110 cancel_delayed_work(&rt->headphone_notify.work); 110 cancel_delayed_work_sync(&rt->headphone_notify.work);
111 cancel_delayed_work(&rt->line_in_notify.work); 111 cancel_delayed_work_sync(&rt->line_in_notify.work);
112 cancel_delayed_work(&rt->line_out_notify.work); 112 cancel_delayed_work_sync(&rt->line_out_notify.work);
113 flush_scheduled_work();
114 113
115 mutex_destroy(&rt->headphone_notify.mutex); 114 mutex_destroy(&rt->headphone_notify.mutex);
116 mutex_destroy(&rt->line_in_notify.mutex); 115 mutex_destroy(&rt->line_in_notify.mutex);
diff --git a/sound/i2c/other/ak4113.c b/sound/i2c/other/ak4113.c
index 971a84a4fa77..c424d329f806 100644
--- a/sound/i2c/other/ak4113.c
+++ b/sound/i2c/other/ak4113.c
@@ -57,8 +57,7 @@ static void snd_ak4113_free(struct ak4113 *chip)
57{ 57{
58 chip->init = 1; /* don't schedule new work */ 58 chip->init = 1; /* don't schedule new work */
59 mb(); 59 mb();
60 cancel_delayed_work(&chip->work); 60 cancel_delayed_work_sync(&chip->work);
61 flush_scheduled_work();
62 kfree(chip); 61 kfree(chip);
63} 62}
64 63
@@ -141,7 +140,7 @@ void snd_ak4113_reinit(struct ak4113 *chip)
141{ 140{
142 chip->init = 1; 141 chip->init = 1;
143 mb(); 142 mb();
144 flush_scheduled_work(); 143 flush_delayed_work_sync(&chip->work);
145 ak4113_init_regs(chip); 144 ak4113_init_regs(chip);
146 /* bring up statistics / event queing */ 145 /* bring up statistics / event queing */
147 chip->init = 0; 146 chip->init = 0;
diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c
index 0341451f814c..d9fb537b0b94 100644
--- a/sound/i2c/other/ak4114.c
+++ b/sound/i2c/other/ak4114.c
@@ -67,8 +67,7 @@ static void snd_ak4114_free(struct ak4114 *chip)
67{ 67{
68 chip->init = 1; /* don't schedule new work */ 68 chip->init = 1; /* don't schedule new work */
69 mb(); 69 mb();
70 cancel_delayed_work(&chip->work); 70 cancel_delayed_work_sync(&chip->work);
71 flush_scheduled_work();
72 kfree(chip); 71 kfree(chip);
73} 72}
74 73
@@ -154,7 +153,7 @@ void snd_ak4114_reinit(struct ak4114 *chip)
154{ 153{
155 chip->init = 1; 154 chip->init = 1;
156 mb(); 155 mb();
157 flush_scheduled_work(); 156 flush_delayed_work_sync(&chip->work);
158 ak4114_init_regs(chip); 157 ak4114_init_regs(chip);
159 /* bring up statistics / event queing */ 158 /* bring up statistics / event queing */
160 chip->init = 0; 159 chip->init = 0;
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index a7630e9edf8a..0fc614ce16c1 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -1014,8 +1014,7 @@ static int snd_ac97_free(struct snd_ac97 *ac97)
1014{ 1014{
1015 if (ac97) { 1015 if (ac97) {
1016#ifdef CONFIG_SND_AC97_POWER_SAVE 1016#ifdef CONFIG_SND_AC97_POWER_SAVE
1017 cancel_delayed_work(&ac97->power_work); 1017 cancel_delayed_work_sync(&ac97->power_work);
1018 flush_scheduled_work();
1019#endif 1018#endif
1020 snd_ac97_proc_done(ac97); 1019 snd_ac97_proc_done(ac97);
1021 if (ac97->bus) 1020 if (ac97->bus)
@@ -2456,8 +2455,7 @@ void snd_ac97_suspend(struct snd_ac97 *ac97)
2456 if (ac97->build_ops->suspend) 2455 if (ac97->build_ops->suspend)
2457 ac97->build_ops->suspend(ac97); 2456 ac97->build_ops->suspend(ac97);
2458#ifdef CONFIG_SND_AC97_POWER_SAVE 2457#ifdef CONFIG_SND_AC97_POWER_SAVE
2459 cancel_delayed_work(&ac97->power_work); 2458 cancel_delayed_work_sync(&ac97->power_work);
2460 flush_scheduled_work();
2461#endif 2459#endif
2462 snd_ac97_powerdown(ac97); 2460 snd_ac97_powerdown(ac97);
2463} 2461}
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index d1c3f8defc48..7f4852a478a1 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -263,8 +263,7 @@ static void vt1708_stop_hp_work(struct via_spec *spec)
263 return; 263 return;
264 snd_hda_codec_write(spec->codec, 0x1, 0, 0xf81, 264 snd_hda_codec_write(spec->codec, 0x1, 0, 0xf81,
265 !spec->vt1708_jack_detectect); 265 !spec->vt1708_jack_detectect);
266 cancel_delayed_work(&spec->vt1708_hp_work); 266 cancel_delayed_work_sync(&spec->vt1708_hp_work);
267 flush_scheduled_work();
268} 267}
269 268
270 269
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c
index e5ebe56fb0c5..969605fbcb7f 100644
--- a/sound/pci/oxygen/oxygen_lib.c
+++ b/sound/pci/oxygen/oxygen_lib.c
@@ -557,7 +557,8 @@ static void oxygen_card_free(struct snd_card *card)
557 oxygen_shutdown(chip); 557 oxygen_shutdown(chip);
558 if (chip->irq >= 0) 558 if (chip->irq >= 0)
559 free_irq(chip->irq, chip); 559 free_irq(chip->irq, chip);
560 flush_scheduled_work(); 560 flush_work_sync(&chip->spdif_input_bits_work);
561 flush_work_sync(&chip->gpio_work);
561 chip->model.cleanup(chip); 562 chip->model.cleanup(chip);
562 kfree(chip->model_data); 563 kfree(chip->model_data);
563 mutex_destroy(&chip->mutex); 564 mutex_destroy(&chip->mutex);
@@ -733,7 +734,8 @@ int oxygen_pci_suspend(struct pci_dev *pci, pm_message_t state)
733 spin_unlock_irq(&chip->reg_lock); 734 spin_unlock_irq(&chip->reg_lock);
734 735
735 synchronize_irq(chip->irq); 736 synchronize_irq(chip->irq);
736 flush_scheduled_work(); 737 flush_work_sync(&chip->spdif_input_bits_work);
738 flush_work_sync(&chip->gpio_work);
737 chip->interrupt_mask = saved_interrupt_mask; 739 chip->interrupt_mask = saved_interrupt_mask;
738 740
739 pci_disable_device(pci); 741 pci_disable_device(pci);
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index 7611add7f8c3..b3e9fac172e5 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -1626,7 +1626,6 @@ static int wm8350_codec_remove(struct snd_soc_codec *codec)
1626{ 1626{
1627 struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec); 1627 struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
1628 struct wm8350 *wm8350 = dev_get_platdata(codec->dev); 1628 struct wm8350 *wm8350 = dev_get_platdata(codec->dev);
1629 int ret;
1630 1629
1631 wm8350_clear_bits(wm8350, WM8350_JACK_DETECT, 1630 wm8350_clear_bits(wm8350, WM8350_JACK_DETECT,
1632 WM8350_JDL_ENA | WM8350_JDR_ENA); 1631 WM8350_JDL_ENA | WM8350_JDR_ENA);
@@ -1641,15 +1640,9 @@ static int wm8350_codec_remove(struct snd_soc_codec *codec)
1641 priv->hpr.jack = NULL; 1640 priv->hpr.jack = NULL;
1642 priv->mic.jack = NULL; 1641 priv->mic.jack = NULL;
1643 1642
1644 /* cancel any work waiting to be queued. */
1645 ret = cancel_delayed_work(&codec->delayed_work);
1646
1647 /* if there was any work waiting then we run it now and 1643 /* if there was any work waiting then we run it now and
1648 * wait for its completion */ 1644 * wait for its completion */
1649 if (ret) { 1645 flush_delayed_work_sync(&codec->delayed_work);
1650 schedule_delayed_work(&codec->delayed_work, 0);
1651 flush_scheduled_work();
1652 }
1653 1646
1654 wm8350_set_bias_level(codec, SND_SOC_BIAS_OFF); 1647 wm8350_set_bias_level(codec, SND_SOC_BIAS_OFF);
1655 1648
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index 8f679a13f2bc..84a23675cba9 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -1526,25 +1526,6 @@ static int wm8753_resume(struct snd_soc_codec *codec)
1526 return 0; 1526 return 0;
1527} 1527}
1528 1528
1529/*
1530 * This function forces any delayed work to be queued and run.
1531 */
1532static int run_delayed_work(struct delayed_work *dwork)
1533{
1534 int ret;
1535
1536 /* cancel any work waiting to be queued. */
1537 ret = cancel_delayed_work(dwork);
1538
1539 /* if there was any work waiting then we run it now and
1540 * wait for it's completion */
1541 if (ret) {
1542 schedule_delayed_work(dwork, 0);
1543 flush_scheduled_work();
1544 }
1545 return ret;
1546}
1547
1548static int wm8753_probe(struct snd_soc_codec *codec) 1529static int wm8753_probe(struct snd_soc_codec *codec)
1549{ 1530{
1550 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); 1531 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
@@ -1604,7 +1585,7 @@ static int wm8753_probe(struct snd_soc_codec *codec)
1604/* power down chip */ 1585/* power down chip */
1605static int wm8753_remove(struct snd_soc_codec *codec) 1586static int wm8753_remove(struct snd_soc_codec *codec)
1606{ 1587{
1607 run_delayed_work(&codec->delayed_work); 1588 flush_delayed_work_sync(&codec->delayed_work);
1608 wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF); 1589 wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF);
1609 1590
1610 return 0; 1591 return 0;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 441285ade024..b54ea9a0a1db 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -67,25 +67,6 @@ static int pmdown_time = 5000;
67module_param(pmdown_time, int, 0); 67module_param(pmdown_time, int, 0);
68MODULE_PARM_DESC(pmdown_time, "DAPM stream powerdown time (msecs)"); 68MODULE_PARM_DESC(pmdown_time, "DAPM stream powerdown time (msecs)");
69 69
70/*
71 * This function forces any delayed work to be queued and run.
72 */
73static int run_delayed_work(struct delayed_work *dwork)
74{
75 int ret;
76
77 /* cancel any work waiting to be queued. */
78 ret = cancel_delayed_work(dwork);
79
80 /* if there was any work waiting then we run it now and
81 * wait for it's completion */
82 if (ret) {
83 schedule_delayed_work(dwork, 0);
84 flush_scheduled_work();
85 }
86 return ret;
87}
88
89/* codec register dump */ 70/* codec register dump */
90static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf) 71static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf)
91{ 72{
@@ -1016,7 +997,7 @@ static int soc_suspend(struct device *dev)
1016 997
1017 /* close any waiting streams and save state */ 998 /* close any waiting streams and save state */
1018 for (i = 0; i < card->num_rtd; i++) { 999 for (i = 0; i < card->num_rtd; i++) {
1019 run_delayed_work(&card->rtd[i].delayed_work); 1000 flush_delayed_work_sync(&card->rtd[i].delayed_work);
1020 card->rtd[i].codec->suspend_bias_level = card->rtd[i].codec->bias_level; 1001 card->rtd[i].codec->suspend_bias_level = card->rtd[i].codec->bias_level;
1021 } 1002 }
1022 1003
@@ -1687,7 +1668,7 @@ static int soc_remove(struct platform_device *pdev)
1687 /* make sure any delayed work runs */ 1668 /* make sure any delayed work runs */
1688 for (i = 0; i < card->num_rtd; i++) { 1669 for (i = 0; i < card->num_rtd; i++) {
1689 struct snd_soc_pcm_runtime *rtd = &card->rtd[i]; 1670 struct snd_soc_pcm_runtime *rtd = &card->rtd[i];
1690 run_delayed_work(&rtd->delayed_work); 1671 flush_delayed_work_sync(&rtd->delayed_work);
1691 } 1672 }
1692 1673
1693 /* remove and free each DAI */ 1674 /* remove and free each DAI */
@@ -1718,7 +1699,7 @@ static int soc_poweroff(struct device *dev)
1718 * now, we're shutting down so no imminent restart. */ 1699 * now, we're shutting down so no imminent restart. */
1719 for (i = 0; i < card->num_rtd; i++) { 1700 for (i = 0; i < card->num_rtd; i++) {
1720 struct snd_soc_pcm_runtime *rtd = &card->rtd[i]; 1701 struct snd_soc_pcm_runtime *rtd = &card->rtd[i];
1721 run_delayed_work(&rtd->delayed_work); 1702 flush_delayed_work_sync(&rtd->delayed_work);
1722 } 1703 }
1723 1704
1724 snd_soc_dapm_shutdown(card); 1705 snd_soc_dapm_shutdown(card);