Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp215528ybh; Tue, 14 Jul 2020 23:29:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1CIm4GTG2HEKq5C0lZ3EWe9r7bL9NrRes94F2NstHAipuMvndFmidqBMH39/SVDes/xqt X-Received: by 2002:aa7:db4f:: with SMTP id n15mr7831187edt.193.1594794546958; Tue, 14 Jul 2020 23:29:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594794546; cv=none; d=google.com; s=arc-20160816; b=cHMLxM0eC5xMXA7u/h7gW8/8yqgP36TxHZ36UtZLjX3ZtFPtFG9V7/cA6D81Ha6YFT uAh67BxJVTCK12BJmuGRQv67rz5NG+cdJOG2hNDqJb0rUYEx2lvsj2x78jk4os7NCXjf x7jSyl01U/FjwinWCG03Z8mRQqpj9wKMhVt0su9nrQ/lTaXFORY9A8Yn8cNBlWkd/Brc CO6QOTMEYsSqmRbI6hUsCJx5vj/HE0kQ3eDQto0vo8gJ10dfwBrHTCqszwaJwkDjqV+b +j1UMqc2KS1VZVhtzEVW1tejCq99cSyBKQXyJFsBbstktuNtSYvNIwCaIef+ApNTe0zV ZWwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:ironport-sdr; bh=nPb+7URo9jxN/b9A26PZGHjUdNkc9NHEE2LMmzhTWl0=; b=W9W1fvKjKWCpol/vzJXglg0aNvXC/yP6J9qGRY1iHg9x675IL20yRVBICKmRkBE8Lm aY6mXgF/0oj2HQzSnd3TKjAgl0LWGuycAX9T9udCq5DL11i/QA0J2i2IBExB6C7Jqr79 FTl/8c/JdyxT9+DuAIUDNLRjXpzrdKE4ICJNWp+MPpdvG+jUI5jW6N8Owg7jFRBqihI5 klGtO5B2DXHSe+uabWt/J5fzwlcUfW7aVJZVeNaNPrF+kV22ogRqxDe4lcnCS/QlaT+2 TjUYpAMfs4VlM3EDy8ibBI/aEHnT6ADDH3FU0Xn1Vc5mbMo0pLTpn3WTyH8xAn3UFTrz /dHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id p7si650658ejb.486.2020.07.14.23.28.44; Tue, 14 Jul 2020 23:29:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728590AbgGOG0i (ORCPT + 99 others); Wed, 15 Jul 2020 02:26:38 -0400 Received: from mga06.intel.com ([134.134.136.31]:13928 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725823AbgGOG0h (ORCPT ); Wed, 15 Jul 2020 02:26:37 -0400 IronPort-SDR: aX8gO1l3/YCZT0IADyvypCWaUHx/iWU/gAlcqH08XQR6VX0/L3bauJHC5pWgvI26TAxwmqOVSD J8CNzRKFs46w== X-IronPort-AV: E=McAfee;i="6000,8403,9682"; a="210636613" X-IronPort-AV: E=Sophos;i="5.75,354,1589266800"; d="scan'208";a="210636613" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2020 23:26:36 -0700 IronPort-SDR: tqHfstNg0M1uf5yZLi+bxmXKVxmznw4NYrHFoBc9u/qVBRPVuT7UgqHjQxmVNaHW/Bm0rqf4v8 zRgih0MS3FQw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,354,1589266800"; d="scan'208";a="281986307" Received: from chenyu-office.sh.intel.com ([10.239.158.173]) by orsmga003.jf.intel.com with ESMTP; 14 Jul 2020 23:26:34 -0700 From: Chen Yu To: "Rafael J. Wysocki" , Len Brown Cc: Greg Kroah-Hartman , "Michal Miroslaw" , Zhang Rui , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen Yu Subject: [PATCH 1/2][RESEND v3] PM-runtime: Move all runtime usage related function to runtime.c Date: Wed, 15 Jul 2020 14:27:54 +0800 Message-Id: <9c261b5001c853006e4fe719726948dfe3b4d487.1594790493.git.yu.c.chen@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to track all the runtime usage count change, move the code related to runtime usage count change from pm_runtime.h to runtime.c, so that in runtime.c we can leverage trace event to do the tracking. Meanwhile export pm_runtime_get_noresume() and pm_runtime_put_noidle() so the module can use them. No functional changes intended. Signed-off-by: Chen Yu --- drivers/base/power/runtime.c | 12 ++++++++++++ include/linux/pm_runtime.h | 12 ++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 9f62790f644c..85a248e196ca 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -1738,6 +1738,18 @@ void pm_runtime_drop_link(struct device *dev) spin_unlock_irq(&dev->power.lock); } +void pm_runtime_get_noresume(struct device *dev) +{ + atomic_inc(&dev->power.usage_count); +} +EXPORT_SYMBOL_GPL(pm_runtime_get_noresume); + +void pm_runtime_put_noidle(struct device *dev) +{ + atomic_add_unless(&dev->power.usage_count, -1, 0); +} +EXPORT_SYMBOL_GPL(pm_runtime_put_noidle); + static bool pm_runtime_need_not_resume(struct device *dev) { return atomic_read(&dev->power.usage_count) <= 1 && diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index 3dbc207bff53..26510fef2acd 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h @@ -59,6 +59,8 @@ extern void pm_runtime_get_suppliers(struct device *dev); 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 *dev); +extern void pm_runtime_get_noresume(struct device *dev); +extern void pm_runtime_put_noidle(struct device *dev); static inline int pm_runtime_get_if_in_use(struct device *dev) { @@ -70,16 +72,6 @@ static inline void pm_suspend_ignore_children(struct device *dev, bool enable) dev->power.ignore_children = enable; } -static inline void pm_runtime_get_noresume(struct device *dev) -{ - atomic_inc(&dev->power.usage_count); -} - -static inline void pm_runtime_put_noidle(struct device *dev) -{ - atomic_add_unless(&dev->power.usage_count, -1, 0); -} - static inline bool pm_runtime_suspended(struct device *dev) { return dev->power.runtime_status == RPM_SUSPENDED -- 2.17.1