Received: by 10.213.65.16 with SMTP id m16csp304480imf; Mon, 12 Mar 2018 04:28:23 -0700 (PDT) X-Google-Smtp-Source: AG47ELstl9Yp88vJgPRqq9Qs/L/MelVNVayDy2njKYG8FD0gyg8PiXMuYJWXo0qbgwz9pjVKl5Fn X-Received: by 10.99.95.84 with SMTP id t81mr6094674pgb.400.1520854103891; Mon, 12 Mar 2018 04:28:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520854103; cv=none; d=google.com; s=arc-20160816; b=FPAy2ZwDzuqGTyWOcZPmN8pZFiDTtVNB+1aE6BXzyxMxvCDcSwveGgVliJa+MS5TW7 eF+j6SxUISPRlFAMp5jU9qH8T/kvxSOzqhaT08xyfY3mQJBDkadEjXKYo0+bncRUeyOC TtvZ4xTvJeqyB9CKN4+P+IT+fThEovswEu+KykZOT6mFM6hEiHsXUsj/0P1EO+9os7lL tDJ7xAUBbFfuOYoUsoSpqCOAyGDW0cEdFb81eKItv4punqLSrJ/a+d5AMJYaKNsN3Azn gBbIzZUkpSKuD2Nh43cC9moLe09d+D7Hgq5znhqa9hlyH2Qo2RTYQInq6ovmHX3QiHbZ PAnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=V/edKpYY+kvMYuxATF0JIdbxcIZBMHIGcwMMUmPm+c8=; b=QrQT0mRiwsrXHRXm8Lp3qbK9+SRLtHcXi7jw2+iMjpSt5I8KS1DiTdNA0SkM3BlHGC bvA6wcLjQGyUWVIsKUgGO25qXxZxPSb19WLdgWv4/TUJhJP4UCgF2iS5EfZELw9/JE5B Fs0lTSFVcPmkr66cy18KCxB/UAJ4IhPUcj9HJwb8n/s06cBqMlGK0Hsn7D0RZunMDglD aPK+Sk7TF6ii2aZ4Rgg3wos71i/b5rzN4d9OOLWOwDIx/8xFDNQo7sdkDaRBfccaEonL Oceqx2v+eTZo0j3LnwVhtbTracljdPVpwtSy9JLlVMPuFnnV9IXnoHtHeATWEO2A7iYf So4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=AoDWOdbh; 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 u91-v6si5865342plb.341.2018.03.12.04.28.09; Mon, 12 Mar 2018 04:28:23 -0700 (PDT) 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=fail header.i=@gmail.com header.s=20161025 header.b=AoDWOdbh; 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 S1751337AbeCLL04 (ORCPT + 99 others); Mon, 12 Mar 2018 07:26:56 -0400 Received: from mail-ot0-f194.google.com ([74.125.82.194]:44264 "EHLO mail-ot0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751247AbeCLL0y (ORCPT ); Mon, 12 Mar 2018 07:26:54 -0400 Received: by mail-ot0-f194.google.com with SMTP id 79so14862194oth.11; Mon, 12 Mar 2018 04:26:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=V/edKpYY+kvMYuxATF0JIdbxcIZBMHIGcwMMUmPm+c8=; b=AoDWOdbhjo1U7trVGiy+dULto157VoxWbm6BL+ecpQ9MrUDyBKlLJulVXHVfn1wGgb lrU3Igjgjv7YF7PXiRg1uYeUz3g16rMsOUfmktNe5JZ1qR539SSJfEcmHI8KHf8JqN8+ UAhhtEERVYuV+D2pBepaeRyuiSVUBpEPovrGs86qopmdi9X+lKhXgGnzJnejjKoVlnXk 9zn4KGQZFsK1N+lWpGINjfxTjtaw6zkEa0TzpaiQKN2H/t63VyirTbmXrdfAPona248s n4CssVpUBYrioPV134Huw7gtjY1Q7kjs7hGPrWK/EPoa+mKIFzEShTKPPa3eEnkT2OQd kwwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=V/edKpYY+kvMYuxATF0JIdbxcIZBMHIGcwMMUmPm+c8=; b=XU/Avho3GVDufZ+4BuCAfjRaKlqyXesKRoTPslA5Fci4QEeAC06lIgNhgDoXscDg2t qDbCUNqqPkBWTb3SF/CPJcWzR3i3MxdnFiVGvLjAe59W6fVHb4akJaOLVbMWCdhGbdX8 qGhYc70AKstbfx8c16LhN5RQTf5zRnx8oxZGIoHRO+CEbwTdHGvOTqGAPm0Z1KkGBOxo /9I+mnj2eOxrkqric1W2eXiCS/gjWY8mdWv6E5hLd13t/ai29lWysbU5IBoahzpvCVti YpFe3SvusKR5jHOwzvpqTQ9MPW27fQPA48XCzgg/Gvxrdr6fBKNjccWzmyQ7iMdyZyt0 o9pw== X-Gm-Message-State: AElRT7EDt3GyckpXkl3w1JQ/riLgLYfEsnu3TPblIhQWzIFtLVMsE7N8 I+sxCsBeuLgfKI18YsiVkXKeV7DHTO2dYFALvcboog== X-Received: by 10.157.64.3 with SMTP id m3mr5523642ote.271.1520854014274; Mon, 12 Mar 2018 04:26:54 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:2c92:0:0:0:0:0 with HTTP; Mon, 12 Mar 2018 04:26:53 -0700 (PDT) In-Reply-To: <1520853467-31653-1-git-send-email-anshuman.gupta@intel.com> References: <1520853467-31653-1-git-send-email-anshuman.gupta@intel.com> From: "Rafael J. Wysocki" Date: Mon, 12 Mar 2018 12:26:53 +0100 X-Google-Sender-Auth: p6UdRQVdhHL1bbDiEifmzgyZLYY Message-ID: Subject: Re: [PATCH] [sound] hdac-codec runtime suspended at PM:Suspend. To: Anshuman Gupta Cc: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , Linux Kernel Mailing List , Linux PM Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 12, 2018 at 12:17 PM, Anshuman Gupta wrote: > Keep hdac-codec to be in runtime suspended while entering to suspend. > If hdac-codec is already in runtime suspend state skip its power down > sequence in prepare, power up sequence in complete phase. > > Avoid resuming hdac controller PCI device 00:1f.3 from runtime suspend > state in case hdac-codec already in runtime-suspend state, this is > unnecessary and block the direct complete even for hdac controller > PCI device 00:1f.3. > > This enabled direct complete path for hdac-codec and PCI device 00:1f.3. > > Signed-off-by: Anshuman Gupta > --- > sound/soc/codecs/hdac_hdmi.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c > index f3b4f4d..810a8a6 100644 > --- a/sound/soc/codecs/hdac_hdmi.c > +++ b/sound/soc/codecs/hdac_hdmi.c > @@ -1852,6 +1852,8 @@ static int hdmi_codec_prepare(struct device *dev) > struct hdac_ext_device *edev = to_hda_ext_device(dev); > struct hdac_device *hdac = &edev->hdac; > > + if (pm_runtime_status_suspended(dev)) > + return 1; This is racy in principle, because the runtime PM status can still change after you've checked here. But even if it isn't racy in practice, the following pm_runtime_get_sync() becomes redundant after it, doesn't it? > pm_runtime_get_sync(&edev->hdac.dev); > > /* > @@ -1873,6 +1875,8 @@ static void hdmi_codec_complete(struct device *dev) > struct hdac_hdmi_priv *hdmi = edev->private_data; > struct hdac_device *hdac = &edev->hdac; > > + if (pm_runtime_status_suspended(dev)) > + return; That, again, is somewhat fragile from the concurrency perspective. > /* Power up afg */ > snd_hdac_codec_read(hdac, hdac->afg, 0, AC_VERB_SET_POWER_STATE, > AC_PWRST_D0); > -- > 2.7.4 >