aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2006-12-15 03:30:07 -0500
committerJaroslav Kysela <perex@suse.cz>2007-02-09 03:02:26 -0500
commit4484bb2e93a9ab636d149edc6515c75ea224e2b0 (patch)
tree4cbc87d7c03d76b0f305fcb1a3a9884b9ed306d6
parentca377fecdd822f9ef5b0a21586040e7d0e1d0c7a (diff)
[ALSA] Fix the soc code after dhowells workqueue changes.
From: Andrew Morton <akpm@osdl.org> I converted the workqueues to per-device while I was there. It seems strange to create a new kernel thread (on each CPU!) and to then only have a single global work to ever be queued upon it. Plus without this, I'd have to use the _NAR stuff, gawd help me. Does that workqueue really need to be per-cpu? Does that workqueue really need to exist? Why not use keventd? Cc: Takashi Iwai <tiwai@suse.de> Cc: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
-rw-r--r--include/sound/soc.h2
-rw-r--r--sound/soc/soc-core.c12
2 files changed, 8 insertions, 6 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 3dfe052e0788..c985a111bc3f 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/workqueue.h>
18#include <sound/driver.h> 19#include <sound/driver.h>
19#include <sound/core.h> 20#include <sound/core.h>
20#include <sound/pcm.h> 21#include <sound/pcm.h>
@@ -454,6 +455,7 @@ struct snd_soc_device {
454 struct snd_soc_platform *platform; 455 struct snd_soc_platform *platform;
455 struct snd_soc_codec *codec; 456 struct snd_soc_codec *codec;
456 struct snd_soc_codec_device *codec_dev; 457 struct snd_soc_codec_device *codec_dev;
458 struct delayed_work delayed_work;
457 void *codec_data; 459 void *codec_data;
458}; 460};
459 461
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 90e8841e7e33..0bae14145a03 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -56,7 +56,6 @@
56static DEFINE_MUTEX(pcm_mutex); 56static DEFINE_MUTEX(pcm_mutex);
57static DEFINE_MUTEX(io_mutex); 57static DEFINE_MUTEX(io_mutex);
58static struct workqueue_struct *soc_workq; 58static struct workqueue_struct *soc_workq;
59static struct work_struct soc_stream_work;
60static DECLARE_WAIT_QUEUE_HEAD(soc_pm_waitq); 59static DECLARE_WAIT_QUEUE_HEAD(soc_pm_waitq);
61 60
62/* supported sample rates */ 61/* supported sample rates */
@@ -728,9 +727,10 @@ out:
728 * This is to ensure there are no pops or clicks in between any music tracks 727 * This is to ensure there are no pops or clicks in between any music tracks
729 * due to DAPM power cycling. 728 * due to DAPM power cycling.
730 */ 729 */
731static void close_delayed_work(void *data) 730static void close_delayed_work(struct work_struct *work)
732{ 731{
733 struct snd_soc_device *socdev = data; 732 struct snd_soc_device *socdev =
733 container_of(work, struct snd_soc_device, delayed_work.work);
734 struct snd_soc_codec *codec = socdev->codec; 734 struct snd_soc_codec *codec = socdev->codec;
735 struct snd_soc_codec_dai *codec_dai; 735 struct snd_soc_codec_dai *codec_dai;
736 int i; 736 int i;
@@ -805,7 +805,7 @@ static int soc_codec_close(struct snd_pcm_substream *substream)
805 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 805 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
806 /* start delayed pop wq here for playback streams */ 806 /* start delayed pop wq here for playback streams */
807 rtd->codec_dai->pop_wait = 1; 807 rtd->codec_dai->pop_wait = 1;
808 queue_delayed_work(soc_workq, &soc_stream_work, 808 queue_delayed_work(soc_workq, &socdev->delayed_work,
809 msecs_to_jiffies(pmdown_time)); 809 msecs_to_jiffies(pmdown_time));
810 } else { 810 } else {
811 /* capture streams can be powered down now */ 811 /* capture streams can be powered down now */
@@ -865,7 +865,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
865 SND_SOC_DAPM_STREAM_START); 865 SND_SOC_DAPM_STREAM_START);
866 else { 866 else {
867 rtd->codec_dai->pop_wait = 0; 867 rtd->codec_dai->pop_wait = 0;
868 cancel_delayed_work(&soc_stream_work); 868 cancel_delayed_work(&socdev->delayed_work);
869 if (rtd->codec_dai->digital_mute) 869 if (rtd->codec_dai->digital_mute)
870 rtd->codec_dai->digital_mute(codec, rtd->codec_dai, 0); 870 rtd->codec_dai->digital_mute(codec, rtd->codec_dai, 0);
871 } 871 }
@@ -1225,7 +1225,7 @@ static int soc_probe(struct platform_device *pdev)
1225 soc_workq = create_workqueue("kdapm"); 1225 soc_workq = create_workqueue("kdapm");
1226 if (soc_workq == NULL) 1226 if (soc_workq == NULL)
1227 goto work_err; 1227 goto work_err;
1228 INIT_WORK(&soc_stream_work, close_delayed_work, socdev); 1228 INIT_DELAYED_WORK(&socdev->delayed_work, close_delayed_work);
1229 return 0; 1229 return 0;
1230 1230
1231work_err: 1231work_err: