Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1198356yba; Sun, 14 Apr 2019 03:27:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqxjBC/VlPFSbWVulc4oIGAz8HTkw6aCZE5yi4gTlzILnUlizbpdpeWZRU8qZaSjuMbCJH45 X-Received: by 2002:a63:c505:: with SMTP id f5mr64963251pgd.87.1555237626260; Sun, 14 Apr 2019 03:27:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555237626; cv=none; d=google.com; s=arc-20160816; b=lvlv8osQQojm8MBrVAe/o0aQP6lTSsNGjmv3VruIHBK0gJRIwpe6U2ySgokT23d1Kn w3T0FdhmFqELlR2lOOI23hy+YGaSEubGkgRAmXH+7HvjuzdWTiq0k2zLw8CBHf3TiSMm 3tCwzxOklGFElmsOTEGMUT9QcafTOiEVozRPEnIjZSTMeKldmtqxa+D9EqG4vII1yBV1 1xkC0RRteEhVQyi/qphvW+Z9utgz7qu9EQDtZlylAXxdtpPMA6hKevQ+qy2ZfMYr6E1x 0Jh4bFZPvPYM36KgkiUdU3o1CUHhb66qh/VL1DDYeA3uFpk7IjLfGJhDAhka4K0LphuU iGWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=7uIinLI7wQ+CIrvVXL5NLubUSXARilXWLU7EcuXfwbw=; b=mfbxXo9/QkxkDlOD7A0UP9nSmw1eMFLnTnOZSktgAOWLPBEPyghIro+fiE2Tv2i4M8 4al+vszZToNN/o+wHeVTlOhULIxoRQqjxn6PpHQmibEgqx3Ns7DFZ5z+EsOfgA3IFSf5 5d3b0PBacbY5BfF0skIGN4G9gagpzjxIce0FsdPWEWINArH4ShrQhZgNX7nqBxgcxhQw I7SFRlUJc02o/RpANtkN1cE4PQ0kpuJq07boM7NVKmmuTZOxHdQJzjNjrCU06n7RRjLJ +fBqKqpxKgGkJa6bor/VpHs2oeLmEB/52orDYMYkOfj1Mi2ZSRaQy1ZmH4vNIyTYwKcb +dAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TbAT4O1F; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 14si14518951plb.314.2019.04.14.03.26.49; Sun, 14 Apr 2019 03:27:06 -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=pass header.i=@kernel.org header.s=default header.b=TbAT4O1F; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726296AbfDNK0J (ORCPT + 99 others); Sun, 14 Apr 2019 06:26:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:42750 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725730AbfDNK0J (ORCPT ); Sun, 14 Apr 2019 06:26:09 -0400 Received: from localhost (unknown [106.198.180.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 52E78206BA; Sun, 14 Apr 2019 10:26:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555237568; bh=/dcERjg2sEn/phzonHtWup1Qx9cet1TXUFX1uCkcVb0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TbAT4O1Flt5VpmLGPkeJuoZfUakm9z6foY6NblHMqM3Fxeo3L1p+76hbXHhoyoMhC 7UKe1x3HtrbPYaJibXntIKoyW9bqJN3otkAyAqlOn0UFvrBxqfPPe1C4DlEJbTTFce 37AtHAlgENLYMS9/o+voaS1Nx6Ifj5hJv3pDLbZc= Date: Sun, 14 Apr 2019 15:56:02 +0530 From: Vinod Koul To: Pierre-Louis Bossart Cc: Jan Kotas , "alsa-devel@alsa-project.org" , "linux-kernel@vger.kernel.org" , Srinivas Kandagatla , "sanyog.r.kale@intel.com" Subject: Re: [alsa-devel] [PATCH] soundwire: fix pm_runtime_get_sync return code checks Message-ID: <20190414102601.GM28103@vkoul-mobl> References: <20190405072655.25995-1-jank@cadence.com> <367316fa-9d92-2dfc-32c4-3e0e8c76ef43@linux.intel.com> <92538D7E-C628-40AC-AFE9-52C97B3BC42D@global.cadence.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08-04-19, 12:43, Pierre-Louis Bossart wrote: > > > On 4/8/19 2:12 AM, Jan Kotas wrote: > > > > > > > On 5 Apr 2019, at 17:04, Pierre-Louis Bossart wrote: > > > > > > On 4/5/19 2:26 AM, Jan Kotas wrote: > > > > > > > > ret = pm_runtime_get_sync(slave->bus->dev); > > > > - if (ret < 0) > > > > + if (ret < 0 && ret != -EACCES) > > > > > > > There was a patch submitted on 3/28 by Srinivas Kandagatla who suggested an alternate solution for exactly the same code. > > > > > > + if (pm_runtime_enabled(slave->bus->dev)) { > > > + ret = pm_runtime_get_sync(slave->bus->dev); > > > + if (ret < 0) > > > + return ret; > > > > > > I am far from an expert on pm_runtime but Srinivas' solution looks more elegant to me. > > > > Hello Pierre, > > > > Please take a look at this patch, that was my inspiration: > > https://lists.linuxfoundation.org/pipermail/linux-pm/2011-June/031930.html > > The two patches seems to be identical: > > static inline bool pm_runtime_enabled(struct device *dev) > { > return !dev->power.disable_depth; > } > > static int rpm_resume() > [...] > else if (dev->power.disable_depth > 0) > retval = -EACCES; > > > However I am still not clear on why this might fail. > > I can only think of one possible explanation: there is no explicit > pm_runtime_enable() in the soundwire code, so maybe the expectation is that > the pm_runtime status is inherited from the parent (in the intel case the > PCI driver), and that's missing in non-intel configurations? IIRC that needs to be called by the Intel driver and those patches were not upstreamed. So we dont have fully supported PM on upstream yet! > > > I also took a look, and it seems the value returned by > > pm_runtime_get_syncis simply ignored in a lot of places, > > so checking its value may be excessive. > But not checking seems careless at best... -- ~Vinod