summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/platform/tegra/tegra_prod.c22
-rw-r--r--include/linux/tegra_prod.h18
2 files changed, 40 insertions, 0 deletions
diff --git a/drivers/platform/tegra/tegra_prod.c b/drivers/platform/tegra/tegra_prod.c
index 89246a6d6..269da5a47 100644
--- a/drivers/platform/tegra/tegra_prod.c
+++ b/drivers/platform/tegra/tegra_prod.c
@@ -557,3 +557,25 @@ struct tegra_prod *tegra_prod_get_from_node(struct device_node *np)
557 return tegra_prod_init(np); 557 return tegra_prod_init(np);
558} 558}
559EXPORT_SYMBOL(tegra_prod_get_from_node); 559EXPORT_SYMBOL(tegra_prod_get_from_node);
560
561struct tegra_prod *devm_tegra_prod_get_from_node(struct device *dev,
562 struct device_node *np)
563{
564 struct tegra_prod **ptr, *prod_list;
565
566 ptr = devres_alloc(devm_tegra_prod_release, sizeof(*ptr), GFP_KERNEL);
567 if (!ptr)
568 return ERR_PTR(-ENOMEM);
569
570 prod_list = tegra_prod_init(np);
571 if (IS_ERR(prod_list)) {
572 devres_free(ptr);
573 return prod_list;
574 }
575
576 *ptr = prod_list;
577 devres_add(dev, ptr);
578
579 return prod_list;
580}
581EXPORT_SYMBOL(devm_tegra_prod_get_from_node);
diff --git a/include/linux/tegra_prod.h b/include/linux/tegra_prod.h
index c79519c50..37e84022b 100644
--- a/include/linux/tegra_prod.h
+++ b/include/linux/tegra_prod.h
@@ -88,6 +88,24 @@ struct tegra_prod *devm_tegra_prod_get(struct device *dev);
88struct tegra_prod *tegra_prod_get_from_node(struct device_node *np); 88struct tegra_prod *tegra_prod_get_from_node(struct device_node *np);
89 89
90/** 90/**
91 * devm_tegra_prod_get_from_node(): Get the prod handle from the node.
92 * @dev: Device handle.
93 * @np: Node pointer on which prod setting nodes are available.
94 *
95 * Parse the prod-setting node of the node pointer "np" and keep all prod
96 * setting data in prod handle.
97 * This handle is used for setting prod configurations.
98 *
99 * Returns valid prod_list handle on success or pointer to the error
100 * when it failed.
101 * The allocated resource is released by driver core framework when device
102 * is unbinded and so no need to call any release APIs for the tegra_prod
103 * handle.
104 */
105struct tegra_prod *devm_tegra_prod_get_from_node(struct device *dev,
106 struct device_node *np);
107
108/**
91 * tegra_prod_put(): Put the allocated prod handle. 109 * tegra_prod_put(): Put the allocated prod handle.
92 * @tegra_prod: Tegra prod handle which was allocated by function 110 * @tegra_prod: Tegra prod handle which was allocated by function
93 * devm_tegra_prod_get() or tegra_prod_get_from_node(). 111 * devm_tegra_prod_get() or tegra_prod_get_from_node().