From patchwork Tue Jul 28 04:19:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "U. Artie Eoff" X-Patchwork-Id: 6880341 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1D9479F380 for ; Tue, 28 Jul 2015 08:36:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4D11E2074A for ; Tue, 28 Jul 2015 08:35:59 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id BF60C2073E for ; Tue, 28 Jul 2015 08:35:57 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 01BA726522D; Tue, 28 Jul 2015 06:20:26 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 8D8222651A9; Tue, 28 Jul 2015 06:20:17 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 079532651AF; Tue, 28 Jul 2015 06:20:16 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by alsa0.perex.cz (Postfix) with ESMTP id B90CA2651A8 for ; Tue, 28 Jul 2015 06:20:09 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 27 Jul 2015 21:20:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,560,1432623600"; d="scan'208";a="772529572" Received: from uartie-ird.jf.intel.com (HELO localhost.localdomain) ([10.7.199.67]) by orsmga002.jf.intel.com with ESMTP; 27 Jul 2015 21:20:08 -0700 From: "U. Artie Eoff" To: tiwai@suse.de, alsa-devel@alsa-project.org Date: Mon, 27 Jul 2015 21:19:31 -0700 Message-Id: <1438057171-18045-1-git-send-email-ullysses.a.eoff@intel.com> X-Mailer: git-send-email 1.9.3 Cc: libin.yang@intel.com, zhuo-hao.lee@intel.com, "U. Artie Eoff" Subject: [alsa-devel] [PATCH v2] ALSA: hda - Fix race condition between HDA driver and runtime PM X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Don't execute runtime suspend if HDA is not finished initializing. Otherwise, the following errors can occur in hda: snd_hda_intel 0000:00:1b.0: CORB reset timeout#2, CORBRP = 65535 snd_hda_intel 0000:00:1b.0: no codecs initialized Debugged and root-cause found by zhuo-hao.lee@intel.com v2: remove unnecessary extra check for chip init (libin) Signed-off-by: U. Artie Eoff --- sound/pci/hda/hda_intel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index b729b25a6ad6..15d4e28fc64e 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -1017,17 +1017,19 @@ static int azx_runtime_idle(struct device *dev) struct snd_card *card = dev_get_drvdata(dev); struct azx *chip; struct hda_intel *hda; + struct hdac_bus *bus; if (!card) return 0; chip = card->private_data; hda = container_of(chip, struct hda_intel, chip); + bus = azx_bus(chip); if (chip->disabled || hda->init_failed || !chip->running) return 0; if (!power_save_controller || !azx_has_pm_runtime(chip) || - azx_bus(chip)->codec_powered) + bus->codec_powered || !bus->chip_init) return -EBUSY; return 0;