diff mbox

ALSA: hda - Do not assign streams in reverse order

Message ID 1396949802-22065-1-git-send-email-anssi.hannula@iki.fi (mailing list archive)
State Accepted
Headers show

Commit Message

Anssi Hannula April 8, 2014, 9:36 a.m. UTC
Currently stream numbers are assigned in reverse order.

Unfortunately commit 7546abfb8e1f9933b5 ("ALSA: hda - Increment
default stream numbers for AMD HDMI controllers") assumed this was not
the case (specifically, it had the "old cards had single device only"
=> "extra unused stream numbers do not matter" assumption), causing
non-working audio regressions for AMD Radeon HDMI users.

Change the stream numbers to be assigned in forward order.

The benefit is that regular audio playback will still work even if the
assumed stream count is too high, downside is that a too high stream
count may remain hidden.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77002
Reported-by: Christian Güdel <cg@dmesg.ch>
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Tested-by: Christian Güdel <cg@dmesg.ch> # 3.14
Cc: Alex Deucher <alexander.deucher@amd.com>
---

Rebased for v3.14.

 sound/pci/hda/hda_controller.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Takashi Iwai April 8, 2014, 9:47 a.m. UTC | #1
At Tue,  8 Apr 2014 12:36:42 +0300,
Anssi Hannula wrote:
> 
> Currently stream numbers are assigned in reverse order.
> 
> Unfortunately commit 7546abfb8e1f9933b5 ("ALSA: hda - Increment
> default stream numbers for AMD HDMI controllers") assumed this was not
> the case (specifically, it had the "old cards had single device only"
> => "extra unused stream numbers do not matter" assumption), causing
> non-working audio regressions for AMD Radeon HDMI users.
> 
> Change the stream numbers to be assigned in forward order.
> 
> The benefit is that regular audio playback will still work even if the
> assumed stream count is too high, downside is that a too high stream
> count may remain hidden.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77002
> Reported-by: Christian Güdel <cg@dmesg.ch>
> Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
> Tested-by: Christian Güdel <cg@dmesg.ch> # 3.14
> Cc: Alex Deucher <alexander.deucher@amd.com>

Thanks, applied.

> ---
> 
> Rebased for v3.14.

It's for 3.15 :)


Takashi

> 
>  sound/pci/hda/hda_controller.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
> index 97993e17f46a..3e005e509131 100644
> --- a/sound/pci/hda/hda_controller.c
> +++ b/sound/pci/hda/hda_controller.c
> @@ -187,13 +187,14 @@ azx_assign_device(struct azx *chip, struct snd_pcm_substream *substream)
>  		struct azx_dev *azx_dev = &chip->azx_dev[dev];
>  		dsp_lock(azx_dev);
>  		if (!azx_dev->opened && !dsp_is_locked(azx_dev)) {
> -			res = azx_dev;
> -			if (res->assigned_key == key) {
> -				res->opened = 1;
> -				res->assigned_key = key;
> +			if (azx_dev->assigned_key == key) {
> +				azx_dev->opened = 1;
> +				azx_dev->assigned_key = key;
>  				dsp_unlock(azx_dev);
>  				return azx_dev;
>  			}
> +			if (!res)
> +				res = azx_dev;
>  		}
>  		dsp_unlock(azx_dev);
>  	}
> -- 
> 1.8.4.5
>
diff mbox

Patch

diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
index 97993e17f46a..3e005e509131 100644
--- a/sound/pci/hda/hda_controller.c
+++ b/sound/pci/hda/hda_controller.c
@@ -187,13 +187,14 @@  azx_assign_device(struct azx *chip, struct snd_pcm_substream *substream)
 		struct azx_dev *azx_dev = &chip->azx_dev[dev];
 		dsp_lock(azx_dev);
 		if (!azx_dev->opened && !dsp_is_locked(azx_dev)) {
-			res = azx_dev;
-			if (res->assigned_key == key) {
-				res->opened = 1;
-				res->assigned_key = key;
+			if (azx_dev->assigned_key == key) {
+				azx_dev->opened = 1;
+				azx_dev->assigned_key = key;
 				dsp_unlock(azx_dev);
 				return azx_dev;
 			}
+			if (!res)
+				res = azx_dev;
 		}
 		dsp_unlock(azx_dev);
 	}