diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2017-01-23 10:11:42 +0530 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-01-30 09:22:20 +0100 |
commit | f067a982cefa8df5642212bb0c7e25974831f781 (patch) | |
tree | abc4cc23a4e49cb000104b09182ec4defab569dd /drivers/base/power/opp/opp.h | |
parent | 37a73ec0c9bbd712d24cc2035696893e5b6119a5 (diff) | |
download | talos-obmc-linux-f067a982cefa8df5642212bb0c7e25974831f781.tar.gz talos-obmc-linux-f067a982cefa8df5642212bb0c7e25974831f781.zip |
PM / OPP: Add 'struct kref' to OPP table
Add kref to struct opp_table for easier accounting of the OPP table.
Note that the new routine dev_pm_opp_get_opp_table() takes the reference
from under the opp_table_lock, which guarantees that the OPP table
doesn't get freed unless dev_pm_opp_put_opp_table() is called for the
OPP table.
Two separate release mechanisms are added: locked and unlocked. In
unlocked version the routines aren't required to take/drop
opp_table_lock as the callers have already done that. This is required
to avoid breaking git bisect, otherwise we may get lockdeps between
commits. Once all the users of OPP table are updated the unlocked
version shall be removed.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base/power/opp/opp.h')
-rw-r--r-- | drivers/base/power/opp/opp.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/base/power/opp/opp.h b/drivers/base/power/opp/opp.h index 105243b06373..aae4d8f480ef 100644 --- a/drivers/base/power/opp/opp.h +++ b/drivers/base/power/opp/opp.h @@ -131,6 +131,7 @@ enum opp_table_access { * @rcu_head: RCU callback head used for deferred freeing * @dev_list: list of devices that share these OPPs * @opp_list: table of opps + * @kref: for reference count of the table. * @lock: mutex protecting the opp_list. * @np: struct device_node pointer for opp's DT node. * @clock_latency_ns_max: Max clock latency in nanoseconds. @@ -164,6 +165,7 @@ struct opp_table { struct rcu_head rcu_head; struct list_head dev_list; struct list_head opp_list; + struct kref kref; struct mutex lock; struct device_node *np; @@ -192,6 +194,7 @@ struct opp_table { }; /* Routines internal to opp core */ +void _get_opp_table_kref(struct opp_table *opp_table); struct opp_table *_find_opp_table(struct device *dev); struct opp_table *_add_opp_table(struct device *dev); struct opp_device *_add_opp_dev(const struct device *dev, struct opp_table *opp_table); |