mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Jaroslav Kysela <perex@suse.cz>,
	Linus Torvalds <torvalds@osdl.org>,
	LKML <linux-kernel@vger.kernel.org>, Takashi Iwai <tiwai@suse.de>
Subject: Re: [ALSA PATCH] alsa-git merge request
Date: Fri, 15 Dec 2006 00:17:22 -0800	[thread overview]
Message-ID: <20061215001722.616ea1a8.akpm@osdl.org> (raw)
In-Reply-To: <20061215001319.b6dd7198.akpm@osdl.org>

On Fri, 15 Dec 2006 00:13:19 -0800
Andrew Morton <akpm@osdl.org> wrote:

> It's going to need this fix

And this one, which was sent and ignored a week ago.

Consideration of the below review comments would be useful, too.




From: Andrew Morton <akpm@osdl.org>

Fix the soc code after dhowells workqueue changes.

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: Jaroslav Kysela <perex@suse.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 include/sound/soc.h  |    2 ++
 sound/soc/soc-core.c |   12 ++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff -puN sound/soc/soc-core.c~alsa-workqueue-fixes sound/soc/soc-core.c
--- a/sound/soc/soc-core.c~alsa-workqueue-fixes
+++ a/sound/soc/soc-core.c
@@ -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 */
@@ -728,9 +727,10 @@ out:
  * 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;
@@ -805,7 +805,7 @@ static int soc_codec_close(struct snd_pc
 	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 */
@@ -865,7 +865,7 @@ static int soc_pcm_prepare(struct snd_pc
 					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);
 		}
@@ -1225,7 +1225,7 @@ static int soc_probe(struct platform_dev
 	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:
diff -puN include/sound/soc.h~alsa-workqueue-fixes include/sound/soc.h
--- a/include/sound/soc.h~alsa-workqueue-fixes
+++ a/include/sound/soc.h
@@ -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>
@@ -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;
 };
 
_


  reply	other threads:[~2006-12-15  8:17 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-15  7:52 Jaroslav Kysela
2006-12-15  8:13 ` Andrew Morton
2006-12-15  8:17   ` Andrew Morton [this message]
2006-12-15  8:44     ` Jaroslav Kysela
2006-12-15  8:45   ` Jaroslav Kysela
2006-12-15 16:00 ` Linus Torvalds
  -- strict thread matches above, loose matches on Subject: below --
2008-10-10 12:12 Jaroslav Kysela
2008-10-11 10:21 ` Takashi Iwai
2008-07-14  9:09 Jaroslav Kysela
2008-08-24 21:30 ` Guillaume Chazarain
2008-08-25  5:50   ` Takashi Iwai
2008-08-25 21:36     ` Guillaume Chazarain
2008-08-25 22:43       ` Guillaume Chazarain
2008-08-26  5:59         ` Takashi Iwai
2008-08-26 21:10           ` Guillaume Chazarain
2008-08-27  6:02             ` Takashi Iwai
2008-01-31 17:04 Jaroslav Kysela
2008-01-31 23:24 ` Linus Torvalds
2007-11-19 18:35 Jaroslav Kysela
2007-11-20  6:48 ` Takashi Iwai
2007-11-20 19:20   ` Jaroslav Kysela
2007-10-23  6:14 Jaroslav Kysela
2007-10-16 15:08 Jaroslav Kysela
2007-07-20  9:39 Jaroslav Kysela
2007-05-31  9:07 Jaroslav Kysela
2007-05-16  9:50 Jaroslav Kysela
2007-05-09  9:59 Jaroslav Kysela
2007-05-03 12:51 Jaroslav Kysela
2007-03-14  7:28 Jaroslav Kysela
2007-03-06 14:20 Jaroslav Kysela
2007-02-14  7:46 Jaroslav Kysela
2007-02-14 17:53 ` Linus Torvalds
2007-02-09 14:02 Jaroslav Kysela
2007-02-09 14:15 ` Takashi Iwai
2007-02-09 14:40   ` Jaroslav Kysela
2007-02-09 14:47     ` Takashi Iwai
2007-02-09 15:00       ` Takashi Iwai
2007-02-09 15:30         ` Jaroslav Kysela
2007-02-09 15:58   ` Linus Torvalds
2007-02-09 16:07     ` Jaroslav Kysela
2007-01-23  8:31 Jaroslav Kysela
2007-01-09 14:04 Jaroslav Kysela
2006-12-20  8:52 Jaroslav Kysela
2006-11-28 14:11 Jaroslav Kysela
2006-10-22  9:09 Jaroslav Kysela
2006-10-06 18:27 Jaroslav Kysela
2006-09-23  9:23 Jaroslav Kysela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061215001722.616ea1a8.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@suse.cz \
    --cc=tiwai@suse.de \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®