alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: David Henningsson <david.henningsson@canonical.com>
To: tiwai@suse.de, alsa-devel@alsa-project.org
Cc: David Henningsson <david.henningsson@canonical.com>
Subject: [PATCH 1/5] hda-emu: Store pointers to pcm streams instead of their content
Date: Tue, 21 Aug 2012 10:53:59 +0200	[thread overview]
Message-ID: <1345539243-8147-2-git-send-email-david.henningsson@canonical.com> (raw)
In-Reply-To: <1345539243-8147-1-git-send-email-david.henningsson@canonical.com>

The HDMI playback engine relies on the same pointer value being sent
in hdmi_pcm_open, as being given in the attach_pcm callback.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
---
 hda-emu.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/hda-emu.c b/hda-emu.c
index 77d5a7f..b4bd8a9 100644
--- a/hda-emu.c
+++ b/hda-emu.c
@@ -504,7 +504,7 @@ void hda_log_set_user_pin_configs(unsigned int nid, unsigned int cfg)
 #define MAX_PCM_STREAMS		16
 
 static int num_pcm_streams;
-static struct hda_pcm pcm_streams[MAX_PCM_STREAMS];
+static struct hda_pcm *pcm_streams[MAX_PCM_STREAMS];
 
 #ifndef OLD_HDA_PCM
 /* get a string corresponding to the given HDA_PCM_TYPE_XXX */
@@ -529,7 +529,7 @@ void hda_list_pcms(void)
 	int i;
 
 	for (i = 0; i < num_pcm_streams; i++) {
-		struct hda_pcm *p = &pcm_streams[i];
+		struct hda_pcm *p = pcm_streams[i];
 		if (!p->stream[0].substreams && !p->stream[1].substreams)
 			continue;
 #ifdef OLD_HDA_PCM
@@ -588,26 +588,26 @@ void hda_test_pcm(int id, int op, int subid,
 	unsigned int ctls = 0;
 	int i, err;
 
-	if (id < 0 || id >= num_pcm_streams) {
+	if (id < 0 || id >= num_pcm_streams || !pcm_streams[id]) {
 		hda_log(HDA_LOG_ERR, "Invalid PCM id %d\n", id);
 		return;
 	}
-	if (!pcm_streams[id].stream[0].substreams &&
-	    !pcm_streams[id].stream[1].substreams) {
+	if (!pcm_streams[id]->stream[0].substreams &&
+	    !pcm_streams[id]->stream[1].substreams) {
 		hda_log(HDA_LOG_ERR, "Empty PCM for id %d\n", id);
 		return;
 	}
 
-	if (!pcm_streams[id].stream[dir].substreams) {
+	if (!pcm_streams[id]->stream[dir].substreams) {
 		hda_log(HDA_LOG_INFO, "No substream in PCM %s for %s\n",
-			pcm_streams[id].name,
+			pcm_streams[id]->name,
 			(dir ? "capt" : "play"));
 		return;
 	}
-	if (subid < 0 || subid >= pcm_streams[id].stream[dir].substreams) {
+	if (subid < 0 || subid >= pcm_streams[id]->stream[dir].substreams) {
 		hda_log(HDA_LOG_INFO,
 			"Invalid substream %d for PCM %s for %s\n",
-			subid, pcm_streams[id].name,
+			subid, pcm_streams[id]->name,
 			(dir ? "capt" : "play"));
 		return;
 	}
@@ -624,7 +624,7 @@ void hda_test_pcm(int id, int op, int subid,
 	runtime->format = get_alsa_format(format);
 	runtime->channels = channels;
 
-	hinfo = &pcm_streams[id].stream[dir];
+	hinfo = &pcm_streams[id]->stream[dir];
 
 	runtime->hw.channels_min = hinfo->channels_min;
 	runtime->hw.channels_max = hinfo->channels_max;
@@ -643,7 +643,7 @@ void hda_test_pcm(int id, int op, int subid,
 
 	if (op != PCM_TEST_END) {
 		hda_log(HDA_LOG_INFO, "Open PCM %s for %s\n",
-			pcm_streams[id].name,
+			pcm_streams[id]->name,
 			(dir ? "capt" : "play"));
 		snd_hda_power_up(_codec);
 		err = hinfo->ops.open(hinfo, _codec, substream);
@@ -739,7 +739,7 @@ static int attach_pcm(struct hda_bus *bus, struct hda_codec *codec,
 			hda_log(HDA_LOG_ERR, "Too many streams\n");
 			return 0;
 		}
-		pcm_streams[num_pcm_streams] = *cpcm;
+		pcm_streams[num_pcm_streams] = cpcm;
 #ifdef HAVE_HDA_ATTACH_PCM
 		cpcm->pcm = &dummy_pcm; /* just non-NULL */
 #endif
-- 
1.7.9.5

  reply	other threads:[~2012-08-21  8:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-21  8:53 [PATCH 0/5] hda-emu: Add playback/capture test to test suite David Henningsson
2012-08-21  8:53 ` David Henningsson [this message]
2012-08-21  8:54 ` [PATCH 2/5] hda-emu: Add support for get/set converter channel count David Henningsson
2012-08-21  8:54 ` [PATCH 3/5] hda-emu: Add CX20585 to modem whitelist David Henningsson
2012-08-21  8:54 ` [PATCH 4/5] hda-emu: Add playback/capture test to test suite David Henningsson
2012-08-21  8:54 ` [PATCH 5/5] hda-emu: improve test suite summary script David Henningsson
2012-08-21  9:01 ` [PATCH 0/5] hda-emu: Add playback/capture test to test suite Takashi Iwai

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=1345539243-8147-2-git-send-email-david.henningsson@canonical.com \
    --to=david.henningsson@canonical.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).