Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2297731ybl; Thu, 19 Dec 2019 11:11:16 -0800 (PST) X-Google-Smtp-Source: APXvYqzU5a0ZcsPegYDIjJg76Bm/trqZSSyKt3kGNjOTmH/K/cyIg4A4ye2MH98QJAqWolR1Eedb X-Received: by 2002:a05:6830:18e3:: with SMTP id d3mr4372423otf.190.1576782676471; Thu, 19 Dec 2019 11:11:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576782676; cv=none; d=google.com; s=arc-20160816; b=a8e//fElZPTeccQ1CgWwkxPXa5P81i8ZnZWTxf0CZ3UnH2jOHBrx4aTK1qKVp3I8He c/Xebt+7Ys1diR6Tzxu85Hi4dwS+JttdistUZ3r0z0OYSMX7di65d25DlM+C187P1IM1 PH/fx++Nxq+NjLtiWuETar8D25/uaYRBmqmsvvXfIzHXL9SAhF0O0H1zVtIL6r7CQERu uz4aG4VWOpKx5uYRkF1yI7IAr/Q6omY1UDizVr8Kp05zRMiJfPbaLvjVsXYdMv0FKjGH nVpco4If1IIVzq735krtn6t2XnACADalW7daMs+SjgtP6L57ObRdD8PqH5b69EAgvuEG N+Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XKH2WE43o/NdZDYXEglbneuwShBV5Hc8asOqGjqQpzM=; b=mMznyE61qxbvRC+g1vT/HJpBZAp0YHWmjdV+nhFNDY5cwY4ap6Dvl1xLU7zgn17Si1 o5rkD/HJr+1W004J9/5rRNz8H07A8pcviHEGMqrTHjbkAqAGnG/RXvnm0t8Yr8ZDzxqV 0ZdalPh8qNdZ3Sf64FWVnvA0s/x1uINK8cSyLImyCWDh8dWOeOip1EigYXvcRZlXaEMS ogsqG0617ukJ+LKefqz7Yf7lOcpUg/dWy+g2Vmkhu5lSFMVeSKBg9WU5Uzeqz6FDxgro T2M7vzeEmI900Feb7pTkA8wE9cPkuInAupxiCE6EOnT0iSj9O1s1W7b0SsRmDFFP/Nvg mZKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="clq2Ep/+"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j24si232081otk.76.2019.12.19.11.11.04; Thu, 19 Dec 2019 11:11:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="clq2Ep/+"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728253AbfLSSjk (ORCPT + 99 others); Thu, 19 Dec 2019 13:39:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:57954 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728008AbfLSSjg (ORCPT ); Thu, 19 Dec 2019 13:39:36 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 69DEA24650; Thu, 19 Dec 2019 18:39:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576780775; bh=MfkPB+3mgjzOlIIfBKi6A47gBvuFAvcm/AU/f2h8Kzc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=clq2Ep/+w2KmGH5jMWsd854qbCUGn5FTy93AEMM2i+bTqj6Jgj2Ok9cxU4lE7uuFw kZpHWrbKDFbSDk8rMP0/mxMmHUXyMxNNPYOq2RwSLX7E5hhgKBwiRx9j8B8TykELco cvitRYPEFb6M/E+VX9F7p8O9igivtXlH7Xkdq2yE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Wilson , Takashi Iwai , Sasha Levin Subject: [PATCH 4.4 074/162] ALSA: hda - Fix pending unsol events at shutdown Date: Thu, 19 Dec 2019 19:33:02 +0100 Message-Id: <20191219183212.308417467@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191219183150.477687052@linuxfoundation.org> References: <20191219183150.477687052@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Iwai [ Upstream commit ca58f55108fee41d87c9123f85ad4863e5de7f45 ] This is an alternative fix attemp for the issue reported in the commit caa8422d01e9 ("ALSA: hda: Flush interrupts on disabling") that was reverted later due to regressions. Instead of tweaking the hardware disablement order and the enforced irq flushing, do calling cancel_work_sync() of the unsol work early enough, and explicitly ignore the unsol events during the shutdown by checking the bus->shutdown flag. Fixes: caa8422d01e9 ("ALSA: hda: Flush interrupts on disabling") Cc: Chris Wilson Link: https://lore.kernel.org/r/s5h1ruxt9cz.wl-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/hda_bind.c | 4 ++++ sound/pci/hda/hda_intel.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c index 7ea201c05e5da..d0d6dfbfcfdf8 100644 --- a/sound/pci/hda/hda_bind.c +++ b/sound/pci/hda/hda_bind.c @@ -42,6 +42,10 @@ static void hda_codec_unsol_event(struct hdac_device *dev, unsigned int ev) { struct hda_codec *codec = container_of(dev, struct hda_codec, core); + /* ignore unsol events during shutdown */ + if (codec->bus->shutdown) + return; + if (codec->patch_ops.unsol_event) codec->patch_ops.unsol_event(codec, ev); } diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index ef8955abd9186..3e3277100f08a 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -1310,8 +1310,11 @@ static int azx_free(struct azx *chip) static int azx_dev_disconnect(struct snd_device *device) { struct azx *chip = device->device_data; + struct hdac_bus *bus = azx_bus(chip); chip->bus.shutdown = 1; + cancel_work_sync(&bus->unsol_work); + return 0; } -- 2.20.1