Thread (47 messages) 47 messages, 3 authors, 2015-07-30

[PATCH 07/10] opp: Add OPP sharing information to OPP library

STALE4083d

From: viresh.kumar@linaro.org (Viresh Kumar)
Date: 2015-07-27 03:20:58
Also in: linux-pm
Subsystem: driver core, kobjects, debugfs and sysfs, hibernation (aka software suspend, aka swsusp), power management core, suspend to ram, the rest · Maintainers: Greg Kroah-Hartman, "Rafael J. Wysocki", Danilo Krummrich, Linus Torvalds

On 20-07-15, 10:46, Stephen Boyd wrote:
quoted
+static struct device_opp *_managed_opp(const struct device_node *np)
+{
+	struct device_opp *dev_opp;
+
+	list_for_each_entry_rcu(dev_opp, &dev_opp_list, node)
+		if (dev_opp->np == np) {
+			/*
+			 * Multiple devices can point to the same OPP table and
+			 * so will have same node-pointer, np.
+			 *
+			 * But the OPPs will be considered as shared only if the
+			 * OPP table contains a "opp-shared" property.
+			 */
+			if (dev_opp->shared_opp)
+				return dev_opp;
+			else
+				return NULL;
+		
The janitors will probably find this and say that it could be
simplified to an if () and a return without the else.
And I am trying to make the janitors happy with this:
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
index eb920e3f115b..8c81784fe473 100644
--- a/drivers/base/power/opp.c
+++ b/drivers/base/power/opp.c
@@ -168,7 +168,7 @@ static struct device_opp *_managed_opp(const struct device_node *np)
 {
        struct device_opp *dev_opp;
 
-       list_for_each_entry_rcu(dev_opp, &dev_opp_list, node)
+       list_for_each_entry_rcu(dev_opp, &dev_opp_list, node) {
                if (dev_opp->np == np) {
                        /*
                         * Multiple devices can point to the same OPP table and
@@ -177,11 +177,9 @@ static struct device_opp *_managed_opp(const struct device_node *np)
                         * But the OPPs will be considered as shared only if the
                         * OPP table contains a "opp-shared" property.
                         */
-                       if (dev_opp->shared_opp)
-                               return dev_opp;
-                       else
-                               return NULL;
+                       return dev_opp->shared_opp ? dev_opp : NULL;
                }
+       }
 
        return NULL;
 }
-- 
viresh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help