From patchwork Mon Mar 5 04:37:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 10258095 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 63CB060211 for ; Mon, 5 Mar 2018 04:37:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E20B28876 for ; Mon, 5 Mar 2018 04:37:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 32382288B4; Mon, 5 Mar 2018 04:37:14 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 9343828876 for ; Mon, 5 Mar 2018 04:37:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932578AbeCEEhM (ORCPT ); Sun, 4 Mar 2018 23:37:12 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:38590 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932522AbeCEEhL (ORCPT ); Sun, 4 Mar 2018 23:37:11 -0500 Received: by mail-pg0-f65.google.com with SMTP id l24so6374341pgc.5 for ; Sun, 04 Mar 2018 20:37:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=FT3lCW30a9ctIdq2bIvOMRuxmhQlpHbqoFTwAUTVhnU=; b=a0PPAAsPIIgTDcIIk+gBFyIbqpnbczy5ffSG8tNlEOdFgjaa6UTkFgUVeOGy5iFyUp x6stIq8e2CQXigO7G6zfzbXZ4cfG2EXgQPAWYvpJjyqCbqrbhGygNhfvl2pBm97N2426 yoQGJj16IDJQXPEGL61oOr7HU75haWWEXzNBk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=FT3lCW30a9ctIdq2bIvOMRuxmhQlpHbqoFTwAUTVhnU=; b=mUrgFt4F3YBsVnAIUjbfQ96A5ebKfv6/9bnZ/fnj0EjXdh2M6Ne6LFpv5UAsKoIXOy Yzxt7CSBpNqB/+j7QodpaJdZ/kuPIDAbmorwYJFrSQnIvDv43FFXOfZbyTQkpbUlBHYy AV1NOGWcbjOegapiQMJxg1yE0boZ4Z1LWJOHdIoKcM4VdYudLj/opntmVW5H3F7cUi5q 62wbZXn3yeG4DGxWMMELUy7bdhl3zyHu7Na/xZM71Pw4Y49vGo17r8HPD4apWGOva/i4 LPGMznXZUo5xPHtQeiQ7xx9iTMhX0GnglDysfBTpsDRxu8NtSXeBHYIz3/Sl8lX9nbc2 rGYg== X-Gm-Message-State: APf1xPBUV+sFAh2MgsiiRGXLEXsWN9scZ425bd3Xiwuib7h/4fGfnd+I NkkNfq40ihe5Q4a1bDMCPqcVwQ== X-Google-Smtp-Source: AG47ELsJ8drWokCM4iO064Hr1ozjAniGV3FSQrIE+U/JMdBaGAdqZz1s8sxnc06cGcxZdp3piEJ0JA== X-Received: by 10.99.117.83 with SMTP id f19mr11005055pgn.318.1520224630620; Sun, 04 Mar 2018 20:37:10 -0800 (PST) Received: from localhost ([223.226.75.205]) by smtp.gmail.com with ESMTPSA id t87sm25245697pfi.37.2018.03.04.20.37.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Mar 2018 20:37:10 -0800 (PST) Date: Mon, 5 Mar 2018 10:07:08 +0530 From: Viresh Kumar To: Jordan Crouse Cc: freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, sboyd@codeaurora.org, vireshk@kernel.org, nm@ti.com, linux-pm@vger.kernel.org Subject: Re: [PATCH 1/3] PM / OPP: Add dev_pm_opp_get_np() Message-ID: <20180305043708.GA23018@vireshk-i7> References: <20180302214329.1086-1-jcrouse@codeaurora.org> <20180302214329.1086-2-jcrouse@codeaurora.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180302214329.1086-2-jcrouse@codeaurora.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 02-03-18, 14:43, Jordan Crouse wrote: > Add a function to return the device node associated with a > specific opp which will facilitate detailing with custom > properties in client drivers. > > Signed-off-by: Jordan Crouse > --- > drivers/opp/of.c | 20 ++++++++++++++++++++ > include/linux/pm_opp.h | 6 ++++++ > 2 files changed, 26 insertions(+) I was using a patch for this for quite sometime now, but never posted it. So its your patch which should get merged now. But there are few things that you need to change/fix. Please update your patch based on mine (pasted below) and repost here. And I am not really sure how should this patch get merged. Maybe I will apply the patch and share a branch (which I wouldn't rebase) and you can use that ? diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 21265af55117..b17715bc3c0a 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -736,3 +736,22 @@ struct dev_pm_opp *of_dev_pm_opp_find_required_opp(struct device *dev, return opp; } EXPORT_SYMBOL_GPL(of_dev_pm_opp_find_required_opp); + +/** + * dev_pm_opp_get_of_node() - Gets the DT node corresponding to an opp + * @opp: opp for which DT node has to be returned for + * + * Return: DT node corresponding to the opp, else 0 on success. + * + * The caller needs to put the node of_node_put() after using it. + */ +struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp) +{ + if (IS_ERR_OR_NULL(opp)) { + pr_err("%s: Invalid parameters\n", __func__); + return NULL; + } + + return of_node_get(opp->np); +} +EXPORT_SYMBOL_GPL(dev_pm_opp_get_of_node); diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 528a7d9cf2ef..099b31960dec 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -300,6 +300,7 @@ 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 dev_pm_opp *of_dev_pm_opp_find_required_opp(struct device *dev, struct device_node *np); +struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp); #else static inline int dev_pm_opp_of_add_table(struct device *dev) { @@ -338,6 +339,10 @@ static inline struct dev_pm_opp *of_dev_pm_opp_find_required_opp(struct device * { return NULL; } +static inline struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp) +{ + return NULL; +} #endif #endif /* __LINUX_OPP_H__ */