Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3178535imw; Mon, 11 Jul 2022 03:39:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s5zM2gdrvEE0w84NKuLBD4rJpV1OX6g8nbjxjTs56J1lanbIJhuct99pecpAhz+vxpD7il X-Received: by 2002:a17:907:7632:b0:72b:4d5d:ecce with SMTP id jy18-20020a170907763200b0072b4d5deccemr6833260ejc.11.1657535972374; Mon, 11 Jul 2022 03:39:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657535972; cv=none; d=google.com; s=arc-20160816; b=myCiROpU4C3E7GP+7ekXUOUUwstQnZmi3vvIaMoZ9C5k5jbiIl0h2eXthtXFz33MjV a6NFzOaLdHip66moCE3xkTHN/sAzfVd7jrenbliFp5QWXE7mFLYzV2Ek7iVhpgARbP8d mrF6RoMScE14uy6NbCmW9oSD6hOTYgcicBOkoGwIkmaOUIpQ5xV/CO7h+4IXY/HfDsjU VAXVWiL8jQrdjnR23O3hHuUlA/zQ/Zbo5NCc3o9wEDVB6RKPx+bCfaVzXkgC6Q0TYMfL niCLHQ0NjrCZVCBFp5+b7asWUbrCVvfBwBoSzc75X2WwFUheOSZMb5aS/MsPJf+BaFbW 962w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CbbH5w7UPapQavk0DzGCZygQ85uOEPkoPR00Nr+aYYA=; b=UtTfjPyN8wrepBD81prfWDTaV+j1PrwS7azr5xtHO34MFAbBilxXu7qtaHSQXPsHAO vkbkUk166mqdhJSBOXz5B5CwOdkgCw5KR3scfdxVfK1o2xuJvLzAu5oS+ZditRwMB+CX zEjX4wS7Pes5eT4zO+RJv+oTBcV4HxoLDa05357zZoMvWuL2T4lrAeeKpgq9ssaVX1XH 5/aYNsKvNRwJyunQLtqFvuj++a/CV5DvArHhEEpWNFE3H/MIMSJWH5NoUvPTBUY3GSQC yqj9go+RuCuRtY9pcxRYfZB6w7N3/Qrkr2J/DMv3Gy3QiWP21yLveC2I2wxXzo1IXq0s 2Ycg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C6iq4NSm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b18-20020a056402279200b004357dc75c7esi582923ede.455.2022.07.11.03.39.08; Mon, 11 Jul 2022 03:39:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C6iq4NSm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232041AbiGKJXD (ORCPT + 99 others); Mon, 11 Jul 2022 05:23:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229944AbiGKJWf (ORCPT ); Mon, 11 Jul 2022 05:22:35 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 760355B040; Mon, 11 Jul 2022 02:13:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 958E9CE1179; Mon, 11 Jul 2022 09:13:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80471C34115; Mon, 11 Jul 2022 09:13:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657530800; bh=DP0RzHgVvpINV93axfH8mlgmW+pA1ynqJkwFKH0gK/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C6iq4NSmCoJkiClFR5thEWV0Hl101cL6+lFdDLwAB4+OwQKuh42NfeKTNl1HbK62I h/p7NsU79JfNTDiZ9tXxZqXV7w8VcT4ahA7zkACJtC3oSyWK3c1TaZRs1DSGZLBR8T 0Fu0/072Z7WygUL5/bOGuAuWIZ6bzXkSx7lNuXxM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Rafael J. Wysocki" Subject: [PATCH 5.10 17/55] PM: runtime: Redefine pm_runtime_release_supplier() Date: Mon, 11 Jul 2022 11:07:05 +0200 Message-Id: <20220711090542.273313047@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090541.764895984@linuxfoundation.org> References: <20220711090541.764895984@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki commit 07358194badf73e267289b40b761f5dc56928eab upstream. Instead of passing an extra bool argument to pm_runtime_release_supplier(), make its callers take care of triggering a runtime-suspend of the supplier device as needed. No expected functional impact. Suggested-by: Greg Kroah-Hartman Signed-off-by: Rafael J. Wysocki Reviewed-by: Greg Kroah-Hartman Cc: 5.1+ # 5.1+ Signed-off-by: Greg Kroah-Hartman --- drivers/base/core.c | 3 ++- drivers/base/power/runtime.c | 20 +++++++++----------- include/linux/pm_runtime.h | 5 ++--- 3 files changed, 13 insertions(+), 15 deletions(-) --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -348,7 +348,8 @@ static void device_link_release_fn(struc /* Ensure that all references to the link object have been dropped. */ device_link_synchronize_removal(); - pm_runtime_release_supplier(link, true); + pm_runtime_release_supplier(link); + pm_request_idle(link->supplier); put_device(link->consumer); put_device(link->supplier); --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -308,13 +308,10 @@ static int rpm_get_suppliers(struct devi /** * pm_runtime_release_supplier - Drop references to device link's supplier. * @link: Target device link. - * @check_idle: Whether or not to check if the supplier device is idle. * - * Drop all runtime PM references associated with @link to its supplier device - * and if @check_idle is set, check if that device is idle (and so it can be - * suspended). + * Drop all runtime PM references associated with @link to its supplier device. */ -void pm_runtime_release_supplier(struct device_link *link, bool check_idle) +void pm_runtime_release_supplier(struct device_link *link) { struct device *supplier = link->supplier; @@ -327,9 +324,6 @@ void pm_runtime_release_supplier(struct while (refcount_dec_not_one(&link->rpm_active) && atomic_read(&supplier->power.usage_count) > 0) pm_runtime_put_noidle(supplier); - - if (check_idle) - pm_request_idle(supplier); } static void __rpm_put_suppliers(struct device *dev, bool try_to_suspend) @@ -337,8 +331,11 @@ static void __rpm_put_suppliers(struct d struct device_link *link; list_for_each_entry_rcu(link, &dev->links.suppliers, c_node, - device_links_read_lock_held()) - pm_runtime_release_supplier(link, try_to_suspend); + device_links_read_lock_held()) { + pm_runtime_release_supplier(link); + if (try_to_suspend) + pm_request_idle(link->supplier); + } } static void rpm_put_suppliers(struct device *dev) @@ -1776,7 +1773,8 @@ void pm_runtime_drop_link(struct device_ return; pm_runtime_drop_link_count(link->consumer); - pm_runtime_release_supplier(link, true); + pm_runtime_release_supplier(link); + pm_request_idle(link->supplier); } static bool pm_runtime_need_not_resume(struct device *dev) --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h @@ -58,7 +58,7 @@ extern void pm_runtime_get_suppliers(str extern void pm_runtime_put_suppliers(struct device *dev); extern void pm_runtime_new_link(struct device *dev); extern void pm_runtime_drop_link(struct device_link *link); -extern void pm_runtime_release_supplier(struct device_link *link, bool check_idle); +extern void pm_runtime_release_supplier(struct device_link *link); /** * pm_runtime_get_if_in_use - Conditionally bump up runtime PM usage counter. @@ -280,8 +280,7 @@ static inline void pm_runtime_get_suppli static inline void pm_runtime_put_suppliers(struct device *dev) {} static inline void pm_runtime_new_link(struct device *dev) {} static inline void pm_runtime_drop_link(struct device_link *link) {} -static inline void pm_runtime_release_supplier(struct device_link *link, - bool check_idle) {} +static inline void pm_runtime_release_supplier(struct device_link *link) {} #endif /* !CONFIG_PM */