Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4161403ybi; Mon, 29 Jul 2019 20:36:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6GOia8h4RWDiZHCN3fx+11fs58AfGOovMzgS/J6zYBfCN0J29Wkkwi0CjBfIJtYU2gH/I X-Received: by 2002:a63:6904:: with SMTP id e4mr46272426pgc.321.1564457764325; Mon, 29 Jul 2019 20:36:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564457764; cv=none; d=google.com; s=arc-20160816; b=quWaBjJZg2uWKBLttwP087koHYQaTO9jgBdb7omvv7a6y4n/c1i+BKbUjmkTy7CAGW xaTZtjnsq/J/rs16w7PNDsDVaURydwZRcFTk075Qo9odlGzdPTIc2WZsqkaOwLiEJqgw 8i86f7cKuHah/w3im+fj9aMXiZ2n9PBro5LoeXZgxwN7K78rFX3dMKdKepVZ3wOLR7jK X5jG3Zvzff0XZnXJTm0Fy7RHYf3InIYtdXDgTPWMM/3gQs2QpfUfyGUcQps5N0ECOnZR pW37Pruj7vNk5/WfRbCqQ/f4EImv+O6hK5MQVLcW8EpxQiYEa4sSyctk3pfdMHTPPgFY d0Zw== 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=aL5LmYzrN5DN7+uGlrvbF1/yvAQ3gBjrPO+8zvaNXyM=; b=tGMLx58khV1z+09XK1OrzsgpmqUqrvL4lHkheTT7ByMM6d/6CRWpdPeMQeAFUVIOLG jKy3vtBxDBQbyO++fGt3yyr15y6DT/C6H13JDap6wYRiAzyWmIbVqDxwVu0eFldvoSHB e69i4SWcV9EVwFQ3bHryd10ADKH7/D6gltbh40at1f0FK4kbcEkCYJiPWBhf4J4a58cU GHAYwuHlm0JIOcquxyTohdxvjEaX7KqRbkVsDPpN/pxblFMn0LJiNFpJiTdonpHr416W lY7iACtAhRW54gXxUpoCVUa8zueRV5lNiVV44voq0/OfMlj18c/MHQnKgMf6QSC759Bl AF7Q== 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 y8si27983158plp.96.2019.07.29.20.35.49; Mon, 29 Jul 2019 20:36:04 -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 S1729789AbfG2Xhz (ORCPT + 99 others); Mon, 29 Jul 2019 19:37:55 -0400 Received: from mga14.intel.com ([192.55.52.115]:18711 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727533AbfG2Xhy (ORCPT ); Mon, 29 Jul 2019 19:37:54 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jul 2019 16:37:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,324,1559545200"; d="scan'208";a="165650561" Received: from ahanamuk-mobl.amr.corp.intel.com (HELO [10.251.134.69]) ([10.251.134.69]) by orsmga008.jf.intel.com with ESMTP; 29 Jul 2019 16:37:51 -0700 Subject: Re: [alsa-devel] [RFC PATCH 17/40] soundwire: bus: use runtime_pm_get_sync/pm when enabled To: Andy Shevchenko Cc: alsa-devel@alsa-project.org, "Rafael J. Wysocki" , tiwai@suse.de, gregkh@linuxfoundation.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, vkoul@kernel.org, broonie@kernel.org, srinivas.kandagatla@linaro.org, jank@cadence.com, 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> <45a912c5-134b-8642-70ef-8c1060389300@linux.intel.com> <20190726190823.GD9224@smile.fi.intel.com> From: Pierre-Louis Bossart Message-ID: <5a16d9e6-0a9c-a0a8-3b11-d046247f3879@linux.intel.com> Date: Mon, 29 Jul 2019 17:07:39 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190726190823.GD9224@smile.fi.intel.com> 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 7/26/19 2:08 PM, Andy Shevchenko wrote: > On Fri, Jul 26, 2019 at 01:08:57PM -0500, Pierre-Louis Bossart wrote: >> This thread became unreadable with interleaved top-posting, allow me restate >> the options and ask PM folks what they think >> >> On 7/25/19 6:40 PM, Pierre-Louis Bossart wrote: >>> Not all platforms support runtime_pm for now, let's use runtime_pm >>> only when enabled. > > Just a side note below... > >>> - ret = pm_runtime_get_sync(slave->bus->dev); >>> - if (ret < 0) > > Here... > >>> - return ret; >>> + if (pm_runtime_enabled(slave->bus->dev)) { >>> + ret = pm_runtime_get_sync(slave->bus->dev); >>> + if (ret < 0) > > ...and thus here... > >>> + return ret; >>> + } >>> ret = sdw_transfer(slave->bus, &msg); >>> - pm_runtime_put(slave->bus->dev); >>> + >>> + if (pm_runtime_enabled(slave->bus->dev)) >>> + pm_runtime_put(slave->bus->dev); >> >> This is option1: we explicitly test if pm_runtime is enabled before calling >> _get_sync() and _put() >> >> option2 (suggested by Jan Kotas): catch the -EACCESS error code >> >> ret = pm_runtime_get_sync(slave->bus->dev); >> - 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: static int radeonfb_open(struct fb_info *info, int user) { struct radeon_fbdev *rfbdev = info->par; struct radeon_device *rdev = rfbdev->rdev; int ret = pm_runtime_get_sync(rdev->ddev->dev); if (ret < 0 && ret != -EACCES) { pm_runtime_mark_last_busy(rdev->ddev->dev); pm_runtime_put_autosuspend(rdev->ddev->dev); return ret; } return 0; } unless I am missing something pm_runtime_put_noidle() and _put_autosuspend() are not equivalent, are they?