From patchwork Tue Feb 13 10:24:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhijeet Kumar X-Patchwork-Id: 10215785 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DF0966056F for ; Tue, 13 Feb 2018 10:16:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9450288E0 for ; Tue, 13 Feb 2018 10:16:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDF0828E69; Tue, 13 Feb 2018 10:16:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B3A57288E0 for ; Tue, 13 Feb 2018 10:16:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EAD7789D8D; Tue, 13 Feb 2018 10:16:39 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id D13F589D7B for ; Tue, 13 Feb 2018 10:16:38 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Feb 2018 02:16:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,507,1511856000"; d="scan'208";a="27354088" Received: from intel-h97m-d3h.iind.intel.com ([10.66.247.169]) by orsmga003.jf.intel.com with ESMTP; 13 Feb 2018 02:16:36 -0800 From: abhijeet.kumar@intel.com To: tiwai@suse.de, abhijeet.kumar@intel.com, intel-gfx@lists.freedesktop.org Date: Tue, 13 Feb 2018 15:54:44 +0530 Message-Id: <1518517484-24488-1-git-send-email-abhijeet.kumar@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1518512988-24305-1-git-send-email-abhijeet.kumar@intel.com> References: <1518512988-24305-1-git-send-email-abhijeet.kumar@intel.com> Subject: [Intel-gfx] [PATCH v2] ALSA: hda: Remove finite loop from snd_hdac_sync_power_state() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Abhijeet Kumar Finite loop and msleep was causing few igt@pm_rpm tests failure for HSW and BDW. Thus removing them. Fixes: 3b5b899ca67d ("ALSA: hda: Make use of core codec functions to sync power state") References: https://bugs.freedesktop.org/show_bug.cgi?id=105069 Signed-off-by: Abhijeet Kumar --- Changes in v2: 1. Removed msleep as well. 2. Modified commit message. sound/hda/hdac_device.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c index 7ba100bb1c3f..678ef8950d0c 100644 --- a/sound/hda/hdac_device.c +++ b/sound/hda/hdac_device.c @@ -1079,15 +1079,13 @@ unsigned int snd_hdac_sync_power_state(struct hdac_device *codec, hda_nid_t nid, unsigned int power_state) { unsigned long end_time = jiffies + msecs_to_jiffies(500); - unsigned int state, actual_state, count; + unsigned int state, actual_state; - for (count = 0; count < 500; count++) { + for (; ;) { state = snd_hdac_codec_read(codec, nid, 0, AC_VERB_GET_POWER_STATE, 0); - if (state & AC_PWRST_ERROR) { - msleep(20); + if (state & AC_PWRST_ERROR) break; - } actual_state = (state >> 4) & 0x0f; if (actual_state == power_state) break;