Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp4179419ybg; Mon, 8 Jun 2020 00:46:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxu2THYJJCgGVb27SLmARvYmUpE9j7eGim5yD4rH1CqDW/jf2Dl/oPYgjEpOV+uLHX8iTW6 X-Received: by 2002:a17:906:694c:: with SMTP id c12mr13097020ejs.495.1591602364981; Mon, 08 Jun 2020 00:46:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591602364; cv=none; d=google.com; s=arc-20160816; b=iob4r1Vl7Rsn3+U/eg7MTvOmX1ASLyiwReIjSkennz8UNxm3S5VIwvFveYD4LGVagO erHJRCH43tGujB8QZg1msuWiBQ/h5JVqWSxL4N32AdEq8Ra62O0NIeUW+XcBsBzgVrPt zZQIchcFl/MO4AK6lVVAHCSKcGhCbNVbhjq+S5GFuaSMqXcg9udRVEX7+XdTd7FYS3nY fzudFRH3AqbK9af+Wxb96ce0NUjjNjGD/2IgNtW91CtYO8CXLb+/l+wBlUoLd7EfLL95 erXnrz0YeNyzMIm7l8a4zV3tRN5CvCTBuRqyD/A0E5Sz6bxAWaGw45KsTgjkb4hJe4Hh YO1Q== 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=tscHpm62MzyV23iaAhYQwoa3FLCYJ+tziqOxKW6yAII=; b=KCcw3GHlHgA9wnBB0SOPUXfPuXegdLpbm+u/8qZj+TgmzQl6QUdQMSV9WtbVtWogkx l4jTpFK4PJVUL6DPrWcCJ4hPY8/5/LPVu6PERJp/K89vQc6Yysu8ayCvEyRqgEZi5WRB zLlw0FPiQi5igD872i6jpNBFAoVD5mZbsXSrnFxKaEOj+oOIEKLbjRsPWJnqf2YX1ox+ LDWI7HdO/SobddYACsMuQCPtPBIpYVIH1pwVQtMKJVSTsmI5khexSAw2cWqNseZ2O1Y4 vSeqi1h5jnvdrSGJnIec557lohESaK989s7WhsE6SEzJCMntZmpZn5fIAlK3V2BLLv5z 6FaA== 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 qc4si7975630ejb.369.2020.06.08.00.45.42; Mon, 08 Jun 2020 00:46:04 -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 S1729075AbgFHHlO (ORCPT + 99 others); Mon, 8 Jun 2020 03:41:14 -0400 Received: from mga12.intel.com ([192.55.52.136]:7078 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729046AbgFHHlN (ORCPT ); Mon, 8 Jun 2020 03:41:13 -0400 IronPort-SDR: 3Gg1FWpqdHZ/jkl2vgxRsOqja8svUsIKF0wam3WstZ8IsYGjLSuzp2IjPZj3OyVO7v/btyKpu8 hVl2gZ2ubJjw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2020 00:41:09 -0700 IronPort-SDR: +cZS7Uo1JfltpvAh8vpLKL6o/4HjE9wSx6oKD/5ZWMnBDOFREMOURCMXx9wuFGAUD0b5U3yt9j bjB2QRT3O/Vg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,487,1583222400"; d="scan'208";a="274134916" Received: from chenyu-office.sh.intel.com ([10.239.158.173]) by orsmga006.jf.intel.com with ESMTP; 08 Jun 2020 00:41:07 -0700 From: Chen Yu To: "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman , Michal Miroslaw Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen Yu Subject: [PATCH 1/2][RFC v2] PM-runtime: Move all runtime usage related function to runtime.c Date: Mon, 8 Jun 2020 15:41:58 +0800 Message-Id: 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 change. Reported-by: kernel test robot 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