|
Takashi Iwai |
2b5164 |
From cb04fc3b6b076f67d228a0b7d096c69ad486c09c Mon Sep 17 00:00:00 2001
|
|
Takashi Iwai |
2b5164 |
From: Takashi Iwai <tiwai@suse.de>
|
|
Takashi Iwai |
2b5164 |
Date: Fri, 13 Dec 2019 09:51:10 +0100
|
|
Takashi Iwai |
2b5164 |
Subject: [PATCH] ALSA: hda/ca0132 - Avoid endless loop
|
|
Takashi Iwai |
2b5164 |
Git-commit: cb04fc3b6b076f67d228a0b7d096c69ad486c09c
|
|
Takashi Iwai |
2b5164 |
Patch-mainline: v5.5-rc3
|
|
Takashi Iwai |
2b5164 |
References: git-fixes
|
|
Takashi Iwai |
2b5164 |
|
|
Takashi Iwai |
2b5164 |
Introduce a timeout to dspio_clear_response_queue() so that it won't
|
|
Takashi Iwai |
2b5164 |
be caught in an endless loop even if the hardware doesn't respond
|
|
Takashi Iwai |
2b5164 |
properly.
|
|
Takashi Iwai |
2b5164 |
|
|
Takashi Iwai |
2b5164 |
Fixes: a73d511c4867 ("ALSA: hda/ca0132: Add unsol handler for DSP and jack detection")
|
|
Takashi Iwai |
2b5164 |
Cc: <stable@vger.kernel.org>
|
|
Takashi Iwai |
2b5164 |
Link: https://lore.kernel.org/r/20191213085111.22855-3-tiwai@suse.de
|
|
Takashi Iwai |
2b5164 |
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
|
Takashi Iwai |
2b5164 |
|
|
Takashi Iwai |
2b5164 |
---
|
|
Takashi Iwai |
2b5164 |
sound/pci/hda/patch_ca0132.c | 5 +++--
|
|
Takashi Iwai |
2b5164 |
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
Takashi Iwai |
2b5164 |
|
|
Takashi Iwai |
2b5164 |
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
|
|
Takashi Iwai |
2b5164 |
index c3d34ff3d9ec..8d0209fff8f5 100644
|
|
Takashi Iwai |
2b5164 |
--- a/sound/pci/hda/patch_ca0132.c
|
|
Takashi Iwai |
2b5164 |
+++ b/sound/pci/hda/patch_ca0132.c
|
|
Takashi Iwai |
2b5164 |
@@ -1809,13 +1809,14 @@ struct scp_msg {
|
|
Takashi Iwai |
2b5164 |
|
|
Takashi Iwai |
2b5164 |
static void dspio_clear_response_queue(struct hda_codec *codec)
|
|
Takashi Iwai |
2b5164 |
{
|
|
Takashi Iwai |
2b5164 |
+ unsigned long timeout = jiffies + msecs_to_jiffies(1000);
|
|
Takashi Iwai |
2b5164 |
unsigned int dummy = 0;
|
|
Takashi Iwai |
2b5164 |
- int status = -1;
|
|
Takashi Iwai |
2b5164 |
+ int status;
|
|
Takashi Iwai |
2b5164 |
|
|
Takashi Iwai |
2b5164 |
/* clear all from the response queue */
|
|
Takashi Iwai |
2b5164 |
do {
|
|
Takashi Iwai |
2b5164 |
status = dspio_read(codec, &dummy);
|
|
Takashi Iwai |
2b5164 |
- } while (status == 0);
|
|
Takashi Iwai |
2b5164 |
+ } while (status == 0 && time_before(jiffies, timeout));
|
|
Takashi Iwai |
2b5164 |
}
|
|
Takashi Iwai |
2b5164 |
|
|
Takashi Iwai |
2b5164 |
static int dspio_get_response_data(struct hda_codec *codec)
|
|
Takashi Iwai |
2b5164 |
--
|
|
Takashi Iwai |
2b5164 |
2.16.4
|
|
Takashi Iwai |
2b5164 |
|