diff mbox

[1/7] PM / OPP: Add dev_pm_opp_get_of_node()

Message ID 20180316040824.21472-2-rnayak@codeaurora.org (mailing list archive)
State Superseded, archived
Delegated to: Andy Gross
Headers show

Commit Message

Rajendra Nayak March 16, 2018, 4:08 a.m. UTC
From: Viresh Kumar <viresh.kumar@linaro.org>

This adds a new helper to let the power domain drivers to access
opp->np, so that they can read platform specific properties from the
node.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
---
 drivers/opp/of.c       | 19 +++++++++++++++++++
 include/linux/pm_opp.h |  5 +++++
 2 files changed, 24 insertions(+)

Comments

Stephen Boyd April 7, 2018, 1 p.m. UTC | #1
Quoting Rajendra Nayak (2018-03-15 21:08:18)
> From: Viresh Kumar <viresh.kumar@linaro.org>
> 
> This adds a new helper to let the power domain drivers to access
> opp->np, so that they can read platform specific properties from the
> node.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
> ---

Are there two versions of this patch floating around?

>  drivers/opp/of.c       | 19 +++++++++++++++++++
>  include/linux/pm_opp.h |  5 +++++
>  2 files changed, 24 insertions(+)
> 
> 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.

put the node with of_node_put()

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Viresh Kumar April 9, 2018, 3:22 a.m. UTC | #2
On 07-04-18, 06:00, Stephen Boyd wrote:
> Quoting Rajendra Nayak (2018-03-15 21:08:18)
> > From: Viresh Kumar <viresh.kumar@linaro.org>
> > 
> > This adds a new helper to let the power domain drivers to access
> > opp->np, so that they can read platform specific properties from the
> > node.
> > 
> > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> > Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
> > ---
> 
> Are there two versions of this patch floating around?

Yeah, I will carry this patch in my series now going forward.

> >  drivers/opp/of.c       | 19 +++++++++++++++++++
> >  include/linux/pm_opp.h |  5 +++++
> >  2 files changed, 24 insertions(+)
> > 
> > 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.
> 
> put the node with of_node_put()

Fixed it up, thanks.
Jordan Crouse April 9, 2018, 3:17 p.m. UTC | #3
On Sat, Apr 07, 2018 at 06:00:29AM -0700, Stephen Boyd wrote:
> Quoting Rajendra Nayak (2018-03-15 21:08:18)
> > From: Viresh Kumar <viresh.kumar@linaro.org>
> > 
> > This adds a new helper to let the power domain drivers to access
> > opp->np, so that they can read platform specific properties from the
> > node.
> > 
> > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> > Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
> > ---
> 
> Are there two versions of this patch floating around?

The other one was mine, but it is identical to this.

Jordan
diff mbox

Patch

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__ */