From patchwork Thu Mar 28 15:28:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sibi Sankar X-Patchwork-Id: 10875199 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ADFAF1708 for ; Thu, 28 Mar 2019 15:29:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 988C828685 for ; Thu, 28 Mar 2019 15:29:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 899B92876D; Thu, 28 Mar 2019 15:29:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 212B128685 for ; Thu, 28 Mar 2019 15:29:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726949AbfC1P27 (ORCPT ); Thu, 28 Mar 2019 11:28:59 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:51632 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726525AbfC1P25 (ORCPT ); Thu, 28 Mar 2019 11:28:57 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 5559E6194E; Thu, 28 Mar 2019 15:28:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1553786935; bh=B9hm3m4js6tRmQZKwTll7Uw3VE0CDlgLZj4xvLuVkYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TbcXk2fi2es4Ppg/D3jo8oLFvVguHs4EvouYX9fX5mZ7IrRvCFodQekhyhB1Icn3f o6QFgPlNLYMkBX7VVYiL/sL77BOBsu7MjAVe4IWbZ449jOLbC4p0yzQVN03YgnmHxR Hkzy9cam/CPd8sHxOxfFea0u0m3EXiEjOdSWooXQ= Received: from blr-ubuntu-87.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sibis@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 31B2F618DC; Thu, 28 Mar 2019 15:28:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1553786931; bh=B9hm3m4js6tRmQZKwTll7Uw3VE0CDlgLZj4xvLuVkYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IfA3yBor9su7O5UZqeivHo5AA2L9zSjoElFd/FXy9TimegOQjkhUute2Qx+mqM5md leHKmX8KSaehjADvplyAy97rloNdg+xfGbdjsOYKlBwlvGrYBTcZ3miYqF2m/AAzfO b3G6oA1VtRbBzK5fEGJ8RiJr/O29QAhCje6hNW5I= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 31B2F618DC Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=sibis@codeaurora.org From: Sibi Sankar To: robh+dt@kernel.org, andy.gross@linaro.org, myungjoo.ham@samsung.com, kyungmin.park@samsung.com, rjw@rjwysocki.net, viresh.kumar@linaro.org, nm@ti.com, sboyd@kernel.org, georgi.djakov@linaro.org Cc: bjorn.andersson@linaro.org, david.brown@linaro.org, mark.rutland@arm.com, linux-kernel@vger.kernel.org, linux-arm-msm-owner@vger.kernel.org, devicetree@vger.kernel.org, rnayak@codeaurora.org, cw00.choi@samsung.com, linux-pm@vger.kernel.org, evgreen@chromium.org, daidavid1@codeaurora.org, dianders@chromium.org, Sibi Sankar Subject: [PATCH RFC 2/9] OPP: Export a number of helpers to prevent code duplication Date: Thu, 28 Mar 2019 20:58:15 +0530 Message-Id: <20190328152822.532-3-sibis@codeaurora.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190328152822.532-1-sibis@codeaurora.org> References: <20190328152822.532-1-sibis@codeaurora.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Export 'dev_pm_opp_find_opp_of_np' and 'of_parse_required_nodes' as it will be used by passive governor to parse and auto-populate mapping specified using the required-opps property. Signed-off-by: Sibi Sankar --- drivers/opp/of.c | 13 +++++++++++-- include/linux/pm_opp.h | 13 +++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 539f3d013a59..d9d8875eca05 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -98,8 +98,8 @@ static struct dev_pm_opp *_find_opp_of_np(struct opp_table *opp_table, return NULL; } -static struct device_node *of_parse_required_opp(struct device_node *np, - int index) +struct device_node *of_parse_required_opp(struct device_node *np, + int index) { struct device_node *required_np; @@ -111,6 +111,15 @@ static struct device_node *of_parse_required_opp(struct device_node *np, return required_np; } +EXPORT_SYMBOL_GPL(of_parse_required_opp); + +/* The caller must call dev_pm_opp_put() after the OPP is used */ +struct dev_pm_opp *dev_pm_opp_find_opp_of_np(struct opp_table *opp_table, + struct device_node *opp_np) +{ + return _find_opp_of_np(opp_table, opp_np); +} +EXPORT_SYMBOL_GPL(dev_pm_opp_find_opp_of_np); /* The caller must call dev_pm_opp_put_opp_table() after the table is used */ static struct opp_table *_find_table_of_opp_np(struct device_node *opp_np) diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 82ff8e2e1ff7..d7cb0e65c4f0 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -359,8 +359,11 @@ void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask); int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask); struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev); struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp); +struct device_node *of_parse_required_opp(struct device_node *np, int index); int of_get_required_opp_performance_state(struct device_node *np, int index); void dev_pm_opp_of_register_em(struct cpumask *cpus); +struct dev_pm_opp *dev_pm_opp_find_opp_of_np(struct opp_table *opp_table, + struct device_node *opp_np); #else static inline int dev_pm_opp_of_add_table(struct device *dev) { @@ -390,6 +393,11 @@ static inline int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct return -ENOTSUPP; } +static inline struct dev_pm_opp *dev_pm_opp_find_opp_of_np(struct opp_table *opp_table, struct device_node *opp_np) +{ + return ERR_PTR(-ENOTSUPP); +} + static inline struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev) { return NULL; @@ -408,6 +416,11 @@ static inline int of_get_required_opp_performance_state(struct device_node *np, { return -ENOTSUPP; } + +static inline struct device_node *of_parse_required_opp(struct device_node *np, int index) +{ + return NULL; +} #endif #endif /* __LINUX_OPP_H__ */