Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp763988ybh; Sat, 3 Aug 2019 09:17:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxsY8Qv6JQNMf4QSgFmcv2S1Ucp4+Hbb19nkzVhtZRXtOD5nqF7UnsQCo3T7Ru6CeM9KBf3 X-Received: by 2002:a62:107:: with SMTP id 7mr65862069pfb.4.1564849039327; Sat, 03 Aug 2019 09:17:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564849039; cv=none; d=google.com; s=arc-20160816; b=yX9Dvh6YKc41EpWPnp+NZ6E0p/gLhA6gQBdrxFHZEBMacf/tXkQg/39cP2xjH5VVh3 J54Ic52MQ8NS84asRxFpgR9rguXeZY7DCrBnG9A/hNjpKppHrWuk1Yk0WG0mJDwHeUz0 HJWp6pcZcZM0NOJVpQ/z55cXI/+aF4jmi/JnO15qUjsaaeo9ssdun8lDPVplMF6h9ryB WeqSI23lpYab1YYu14Uv5mqogi+roBE+kEJLGDxO/ghMQxi5BNPCWP5kHwks6sxTvhl8 FKMgWS5PqR7NBJ8LvyJMgX6nARsWzBdfaSHr3P30Hn7tPl83ZY5rAHjGp1aWdJ+nw0om fQAg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=K3EY2t2rDK5IX5NUn2pZDZPLoRrLJ0hnRm3dTDRMiOo=; b=UDyjsXuQHKwM4d7PuGWm9qDqXQU3U+u3esCz4zfh8UbKg7R4kviWd5iNDEdMuYCHaO nK5jzgdlExvo8lKMS7fh8nYTC+ycxQx/V6tfCka5t/hpk5FBblCqID5z53cgFbEjegJ3 /lbV8PjrN5Uj9/OzEOQvmHH9NG8qhQWzIDlQPTgf3Y9efwsuIb/74n0EXxEEc26TIVD3 5jGXLYO9aSBVBlJ77X4T/pdJHHlb1aYnHz/5jIvhwRah0ZkfhRRylqsRogDoI9yktL/T ouFFqkz8cEHQ2x5UIjD5LvqUq5RPhgns4z/OWPINfg2a08lZeMevHbSVhoRUz6500LIb YIDQ== 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 61si41051552plb.270.2019.08.03.09.17.04; Sat, 03 Aug 2019 09:17:19 -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 S2391795AbfHBRUN (ORCPT + 99 others); Fri, 2 Aug 2019 13:20:13 -0400 Received: from mga04.intel.com ([192.55.52.120]:56340 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388134AbfHBRUN (ORCPT ); Fri, 2 Aug 2019 13:20:13 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Aug 2019 10:20:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,338,1559545200"; d="scan'208";a="197270088" Received: from linux.intel.com ([10.54.29.200]) by fmsmga004.fm.intel.com with ESMTP; 02 Aug 2019 10:20:12 -0700 Received: from cwhanson-mobl.amr.corp.intel.com (unknown [10.252.133.191]) by linux.intel.com (Postfix) with ESMTP id 6A9885805B9; Fri, 2 Aug 2019 10:20:11 -0700 (PDT) Subject: Re: [RFC PATCH 17/40] soundwire: bus: use runtime_pm_get_sync/pm when enabled To: Vinod Koul Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@kernel.org, gregkh@linuxfoundation.org, jank@cadence.com, srinivas.kandagatla@linaro.org, slawomir.blauciak@intel.com, Sanyog Kale References: <20190725234032.21152-1-pierre-louis.bossart@linux.intel.com> <20190725234032.21152-18-pierre-louis.bossart@linux.intel.com> <20190802165816.GU12733@vkoul-mobl.Dlink> From: Pierre-Louis Bossart Message-ID: <1ca3579b-00ac-39a7-d60b-908d1447677c@linux.intel.com> Date: Fri, 2 Aug 2019 12:20:10 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190802165816.GU12733@vkoul-mobl.Dlink> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/2/19 11:58 AM, Vinod Koul wrote: > On 25-07-19, 18:40, Pierre-Louis Bossart wrote: >> Not all platforms support runtime_pm for now, let's use runtime_pm >> only when enabled. > > We discussed this with Ulf sometime back and it was a consensus the core > should handle it, but that may take a while. > > So that led me to explore what others do notably ASoC, based on this I > feel we should not check the error code. We handle the non streaming > case here but streaming is handled in ASoC which doesnt check the return > > Pierre, can you verify the below patch and let me know if that is fine > for Intel platforms So if for some reason we cannot resume, then we'd still initiate a transaction and have even more issues to sort out. Fail big and fail early would really be my preference. Also the user of this function is largely the Slave driver, which typically doesn't do any streaming operation but controls the imp-def registers. The bus driver will only use this routine for standard registers and that's a very small part of the total traffic. > > --- >8 --- > > From: Vinod Koul > Date: Fri, 2 Aug 2019 22:15:11 +0530 > Subject: [PATCH] soundwire: dont check return of pm_runtime_get_sync() > > Soundwire core checks pm_runtime_get_sync() return. But in case the > driver has not enabled runtime pm we get an error. > > To fix this, dont check the return. We handle the non streaming case in > framework but streaming case has similar handling in ASoC so make it > same across use cases > > Signed-off-by: Vinod Koul > --- > drivers/soundwire/bus.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c > index fe745830a261..9cdf7e9e0852 100644 > --- a/drivers/soundwire/bus.c > +++ b/drivers/soundwire/bus.c > @@ -326,9 +326,7 @@ int sdw_nread(struct sdw_slave *slave, u32 addr, size_t count, u8 *val) > if (ret < 0) > return ret; > > - ret = pm_runtime_get_sync(slave->bus->dev); > - if (ret < 0) > - return ret; > + pm_runtime_get_sync(slave->bus->dev); > > ret = sdw_transfer(slave->bus, &msg); > pm_runtime_put(slave->bus->dev); > @@ -354,9 +352,7 @@ int sdw_nwrite(struct sdw_slave *slave, u32 addr, size_t count, u8 *val) > if (ret < 0) > return ret; > > - ret = pm_runtime_get_sync(slave->bus->dev); > - if (ret < 0) > - return ret; > + pm_runtime_get_sync(slave->bus->dev); > > ret = sdw_transfer(slave->bus, &msg); > pm_runtime_put(slave->bus->dev); >