Skip to content

Commit

Permalink
[ALSA] Fix the soc code after dhowells workqueue changes.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andrew Morton authored and Jaroslav Kysela committed Feb 9, 2007
1 parent ca377fe commit 4484bb2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include <linux/platform_device.h>
#include <linux/types.h>
#include <linux/workqueue.h>
#include <sound/driver.h>
#include <sound/core.h>
#include <sound/pcm.h>
Expand Down Expand Up @@ -454,6 +455,7 @@ struct snd_soc_device {
struct snd_soc_platform *platform;
struct snd_soc_codec *codec;
struct snd_soc_codec_device *codec_dev;
struct delayed_work delayed_work;
void *codec_data;
};

Expand Down
12 changes: 6 additions & 6 deletions sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
static DEFINE_MUTEX(pcm_mutex);
static DEFINE_MUTEX(io_mutex);
static struct workqueue_struct *soc_workq;
static struct work_struct soc_stream_work;
static DECLARE_WAIT_QUEUE_HEAD(soc_pm_waitq);

/* supported sample rates */
Expand Down Expand Up @@ -728,9 +727,10 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
* This is to ensure there are no pops or clicks in between any music tracks
* due to DAPM power cycling.
*/
static void close_delayed_work(void *data)
static void close_delayed_work(struct work_struct *work)
{
struct snd_soc_device *socdev = data;
struct snd_soc_device *socdev =
container_of(work, struct snd_soc_device, delayed_work.work);
struct snd_soc_codec *codec = socdev->codec;
struct snd_soc_codec_dai *codec_dai;
int i;
Expand Down Expand Up @@ -805,7 +805,7 @@ static int soc_codec_close(struct snd_pcm_substream *substream)
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
/* start delayed pop wq here for playback streams */
rtd->codec_dai->pop_wait = 1;
queue_delayed_work(soc_workq, &soc_stream_work,
queue_delayed_work(soc_workq, &socdev->delayed_work,
msecs_to_jiffies(pmdown_time));
} else {
/* capture streams can be powered down now */
Expand Down Expand Up @@ -865,7 +865,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
SND_SOC_DAPM_STREAM_START);
else {
rtd->codec_dai->pop_wait = 0;
cancel_delayed_work(&soc_stream_work);
cancel_delayed_work(&socdev->delayed_work);
if (rtd->codec_dai->digital_mute)
rtd->codec_dai->digital_mute(codec, rtd->codec_dai, 0);
}
Expand Down Expand Up @@ -1225,7 +1225,7 @@ static int soc_probe(struct platform_device *pdev)
soc_workq = create_workqueue("kdapm");
if (soc_workq == NULL)
goto work_err;
INIT_WORK(&soc_stream_work, close_delayed_work, socdev);
INIT_DELAYED_WORK(&socdev->delayed_work, close_delayed_work);
return 0;

work_err:
Expand Down

0 comments on commit 4484bb2

Please sign in to comment.