Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4882216ybi; Tue, 30 Jul 2019 09:45:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqykI4ikFVLhpG3ezDpMAO/YXHXH3BuZTJe1vFi6h/XsjJn5l7CwqjNxf4TYlaXXSXqWE7sX X-Received: by 2002:a63:2ec9:: with SMTP id u192mr107360549pgu.16.1564505141632; Tue, 30 Jul 2019 09:45:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564505141; cv=none; d=google.com; s=arc-20160816; b=eH4pon4LmGqvpi2hNaQRYd7Ibq74RIFfPXZvteigREwj/hWL5hOyfU9VzZAk74L4jZ xS8fSFOJDmPkstXeAqPdiU01Cyq9KiSDJN9phcDc9KsUTkhcQzeZyug6DmyyrBFv0on/ kQ6kU/6Hnb0ATjjBozyjHlbDLEAWOZbjLV6NW8xi8hba9+nh7JuRR8iUy9Z4wgENNK+Q Nbg40XCdEPvlI+ePRJaRn7+k+Va7O5k7QXAXDWju3Ed3D5NQHbJ5yyP0jkt0X7My69lU 7FzyIVrcokq48e48YuZubZbYlu740R6HKXUrI5jxxPgMwWpwHWHpmE4m7p9LLQN76WHI 9DuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=40bcXsMHv5cwIc5sS78iWpY6EpEgKcN7nhQvS2uXD8k=; b=q4w4goDRPdE84ZGct709nkYG7m4c06LV5m4ZepwaJlSu1s5yE3NNyCk2ghWvHaxeJq 70mlCRLFdwoBrxnF6uWW4l3Pc8g4CimocaM7/l+fQ1w6aozeMrr0NxKSzdCTyWBpnWu8 KqJp/kjFbcuE/H9dFxl49ECv+kfgAjpQh3No/5Fata3C/0nBuxVGAazrhw5fkisVrJF2 xPJVEUoo4RP5GC7QeI4WqXL/h8YfJYWWbMbf5h63hftwzxTdOFMVeF1JPL7eWPuU7XTD 7SWe9BveWuVg6LteMnArFMFr5AQ9xPcTAuxkRM2E1/tXgAJY/eDySGYahP0rAyvJ8pnG QHhQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a190si30857172pgc.25.2019.07.30.09.45.26; Tue, 30 Jul 2019 09:45:41 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730291AbfG3P6Q (ORCPT + 99 others); Tue, 30 Jul 2019 11:58:16 -0400 Received: from mga07.intel.com ([134.134.136.100]:55522 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728759AbfG3P6Q (ORCPT ); Tue, 30 Jul 2019 11:58:16 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jul 2019 08:58:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,327,1559545200"; d="scan'208";a="255645883" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.145]) by orsmga001.jf.intel.com with ESMTP; 30 Jul 2019 08:58:11 -0700 Received: from andy by smile with local (Exim 4.92) (envelope-from ) id 1hsUVt-0005F7-JJ; Tue, 30 Jul 2019 18:58:09 +0300 Date: Tue, 30 Jul 2019 18:58:09 +0300 From: Andy Shevchenko To: Pierre-Louis Bossart Cc: alsa-devel@alsa-project.org, linux-pm@vger.kernel.org, tiwai@suse.de, gregkh@linuxfoundation.org, "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, vkoul@kernel.org, broonie@kernel.org, srinivas.kandagatla@linaro.org, jank@cadence.com, slawomir.blauciak@intel.com, Sanyog Kale Subject: Re: [alsa-devel] [RFC PATCH 17/40] soundwire: bus: use runtime_pm_get_sync/pm when enabled Message-ID: <20190730155809.GS23480@smile.fi.intel.com> References: <20190725234032.21152-1-pierre-louis.bossart@linux.intel.com> <20190725234032.21152-18-pierre-louis.bossart@linux.intel.com> <45a912c5-134b-8642-70ef-8c1060389300@linux.intel.com> <20190726190823.GD9224@smile.fi.intel.com> <5a16d9e6-0a9c-a0a8-3b11-d046247f3879@linux.intel.com> <20190730112157.GM23480@smile.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 30, 2019 at 07:57:46AM -0500, Pierre-Louis Bossart wrote: > On 7/30/19 6:21 AM, Andy Shevchenko wrote: > > On Mon, Jul 29, 2019 at 05:07:39PM -0500, Pierre-Louis Bossart wrote: > > > On 7/26/19 2:08 PM, Andy Shevchenko wrote: > > > > On Fri, Jul 26, 2019 at 01:08:57PM -0500, Pierre-Louis Bossart wrote: > > > > > > > - if (ret < 0) > > > > > + if (ret < 0 && ret != -EACCES) > > > > > > > > ...and here, the pm_runtime_put_noidle() call is missed. > > > > > > yes but in the example you provided, they actually do more work than just > > > decrement the device usage counter: > > > > In their case they would like to do that. You decide what is appropriate call > > in your case. > > > > My point is, that reference counter in case of error handling should be > > returned back to its value. > > Agree on the reference count. > I am however not clear on the next step and 'what is appropriate'. > > If pm_runtime_get_sync() failed, then technically the device was not resumed Not so straight. It depends on reference count. It might be true (most cases I think), or not true, if device had been resumed previously by other call. > so marking it as last_busy+autosuspend, or using a plain vanilla put() will > not result in any action. I must be missing something here. put_noidle(). Because if it failed on the first call and was resumed, put() will try to shut it down (since reference count goes to no-user base). -- With Best Regards, Andy Shevchenko