[RFC v3 07/10] opp: Remove multiple attached opp tables from a device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Introduce _dev_pm_opp_find_and_remove_table_indexed to remove
all the linked opp tables from a device.

Signed-off-by: Sibi Sankar <sibis@xxxxxxxxxxxxxx>
---
 drivers/opp/core.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index e9d633c9e40b1..cc2f156db7fda 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -2632,12 +2632,13 @@ int dev_pm_opp_unregister_notifier(struct device *dev,
 }
 EXPORT_SYMBOL(dev_pm_opp_unregister_notifier);
 
-void _dev_pm_opp_find_and_remove_table(struct device *dev)
+static void _dev_pm_opp_find_and_remove_table_indexed(struct device *dev,
+						      int index)
 {
 	struct opp_table *opp_table;
 
 	/* Check for existing table for 'dev' */
-	opp_table = _find_opp_table_indexed(dev, 0);
+	opp_table = _find_opp_table_indexed(dev, index);
 	if (IS_ERR(opp_table)) {
 		int error = PTR_ERR(opp_table);
 
@@ -2658,6 +2659,18 @@ void _dev_pm_opp_find_and_remove_table(struct device *dev)
 	dev_pm_opp_put_opp_table(opp_table);
 }
 
+void _dev_pm_opp_find_and_remove_table(struct device *dev)
+{
+	int count, i;
+
+	count = of_count_phandle_with_args(dev->of_node,
+					   "operating-points-v2", NULL);
+	count = max(count, 1);
+
+	for (i = 0; i < count; i++)
+		_dev_pm_opp_find_and_remove_table_indexed(dev, i);
+}
+
 /**
  * dev_pm_opp_remove_table() - Free all OPPs associated with the device
  * @dev:	device pointer used to lookup OPP table.
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux