Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp540412ybh; Wed, 15 Jul 2020 08:36:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyO9sevwlZMw+//zNSO5URv/jo2Rdma/mhi5hR65rKWkJIXfWolqtBvtNWf/nYqqj8rrQNu X-Received: by 2002:a50:d784:: with SMTP id w4mr217557edi.34.1594827401076; Wed, 15 Jul 2020 08:36:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594827401; cv=none; d=google.com; s=arc-20160816; b=FutGQ0m8r2I7TnkTSWnfWCuKxv9SxCA7FxdhPvtFCPzh661lGIhKwvhD3xDNxoXJMf zZII1LmaMZx7jen0p3xIndyTUE3slshsP+3w6C/6JFYUai/aACSulDG4++V/9miTNR9v bpBiyGslE9PlbJf4DhcDWkmNtYyQtiB6fvRe1jAYaKTbkx8X6bBHdUU3Kd3W7f2fkwtQ JsBGmimxK0UVtUDkmA93s4knMqfo6C0tqhbZhpo/Km9DVMJOlXkyBZq8RVgjtBS29dkV mrKSi21RFesuw7MWBWz/wzx4JgPEIkvZ2bEcT1bfr5KsiRJPvmkHV7trNWEjvODEKy+A uIfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=+lRS/tWjF+I7awdCql4jqwqaHB+t8A414qDcPmgKQpY=; b=QHNivdJDk52Hu6q0a92Lhek8je7/Hy71qxU6e5OX4D/rQNVZ7e9zhu3PAci65unu// FXLR1PnkBMRGLutVGoed1dlDgWO0LXyrx+cBkbqj+kFriuP8swJhPz8iRgQ9QswLwQDv +yMRkCTSitDPdEqQiY1barlPXw6DKfbzE/J44+1DqPNAY2mi7O6smAE9EKrnAgXbOu9E 0FU7vUqLxUeQr2x12lXf+PeT0H7tvlEKVtkHBeSw3PdniCul9hTsREG5LoZbusszmdKk BiHKRM63h2yojWeUAkpx2RkMBUkIEFXsdlW3VcrSVXznxOlZ2r1Ipst2yPVwCVJmooqh fEog== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b5si1471091edy.563.2020.07.15.08.36.18; Wed, 15 Jul 2020 08:36:41 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726830AbgGOPf2 (ORCPT + 99 others); Wed, 15 Jul 2020 11:35:28 -0400 Received: from mail-oo1-f68.google.com ([209.85.161.68]:35911 "EHLO mail-oo1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725770AbgGOPf1 (ORCPT ); Wed, 15 Jul 2020 11:35:27 -0400 Received: by mail-oo1-f68.google.com with SMTP id z127so550324ooa.3; Wed, 15 Jul 2020 08:35:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+lRS/tWjF+I7awdCql4jqwqaHB+t8A414qDcPmgKQpY=; b=c2qVcQeaQB/dHqFZxebtn/y0Yxpa9rRzUqP9YgqFxd+gb+isVyNvcZ6Zk9wU7j4ZO3 maD3LbMeCozUolAX6CCFxuIfvTjKEXH5/SAidNTRxl/BlTpjwyx3SFy6EHzdQDDPEOpr tbAInZ7vVmrZ4OfCpKSH82jOMOJ6cneFtruvlg8rW9VcryHXsO5+D+C7uySFzGZVJvr3 TQVLWblN0tVMWCJzE9mIRhHL1dtc3HRwHIKv0j8iKLyXeIaP7l46P4Wt2lruoOQjP504 ivBjSBe0dgidh4MkuVytCa8EiWa4x5O8bxrmbo7DjF+mYF+YmD0hhckOYvgahMMsrmup pSGg== X-Gm-Message-State: AOAM531p03m+zDWtJgDTnPxoRMOdLKl3cVImmnXvMtNNqmJtVO23UzJ7 Itp+DvEyFwZDMjswu+EOIqCgv3lb4584V6yzQ9Q= X-Received: by 2002:a4a:9552:: with SMTP id n18mr9927340ooi.1.1594827327053; Wed, 15 Jul 2020 08:35:27 -0700 (PDT) MIME-Version: 1.0 References: <9c261b5001c853006e4fe719726948dfe3b4d487.1594790493.git.yu.c.chen@intel.com> In-Reply-To: <9c261b5001c853006e4fe719726948dfe3b4d487.1594790493.git.yu.c.chen@intel.com> From: "Rafael J. Wysocki" Date: Wed, 15 Jul 2020 17:35:16 +0200 Message-ID: Subject: Re: [PATCH 1/2][RESEND v3] PM-runtime: Move all runtime usage related function to runtime.c To: Chen Yu Cc: "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman , Michal Miroslaw , Zhang Rui , Linux PM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 15, 2020 at 8:26 AM Chen Yu wrote: > > 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); I honestly don't think that this is going in the right direction. > + > 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 >