diff options
-rw-r--r-- | drivers/opp/core.c | 9 | ||||
-rw-r--r-- | drivers/opp/of.c | 9 | ||||
-rw-r--r-- | include/linux/pm_opp.h | 7 |
3 files changed, 12 insertions, 13 deletions
diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 150439a18b87..14fb0f43cc77 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -58,10 +58,8 @@ static struct opp_table *_find_opp_table_unlocked(struct device *dev) struct opp_table *opp_table; list_for_each_entry(opp_table, &opp_tables, node) { - if (_find_opp_dev(dev, opp_table)) { - dev_pm_opp_get_opp_table_ref(opp_table); - return opp_table; - } + if (_find_opp_dev(dev, opp_table)) + return dev_pm_opp_get_opp_table_ref(opp_table); } return ERR_PTR(-ENODEV); @@ -1687,9 +1685,10 @@ static void _opp_table_kref_release(struct kref *kref) kfree(opp_table); } -void dev_pm_opp_get_opp_table_ref(struct opp_table *opp_table) +struct opp_table *dev_pm_opp_get_opp_table_ref(struct opp_table *opp_table) { kref_get(&opp_table->kref); + return opp_table; } EXPORT_SYMBOL_GPL(dev_pm_opp_get_opp_table_ref); diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 87cb6aeb49ed..c240acc81a8d 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -60,10 +60,8 @@ struct opp_table *_managed_opp(struct device *dev, int index) * But the OPPs will be considered as shared only if the * OPP table contains a "opp-shared" property. */ - if (opp_table->shared_opp == OPP_TABLE_ACCESS_SHARED) { - dev_pm_opp_get_opp_table_ref(opp_table); - managed_table = opp_table; - } + if (opp_table->shared_opp == OPP_TABLE_ACCESS_SHARED) + managed_table = dev_pm_opp_get_opp_table_ref(opp_table); break; } @@ -405,8 +403,7 @@ static void lazy_link_required_opp_table(struct opp_table *new_table) continue; } - required_opp_tables[i] = new_table; - dev_pm_opp_get_opp_table_ref(new_table); + required_opp_tables[i] = dev_pm_opp_get_opp_table_ref(new_table); /* Link OPPs now */ ret = lazy_link_required_opps(opp_table, new_table, i); diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 5e4c3428b139..0deddfa91aca 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -100,7 +100,7 @@ struct dev_pm_opp_data { #if defined(CONFIG_PM_OPP) struct opp_table *dev_pm_opp_get_opp_table(struct device *dev); -void dev_pm_opp_get_opp_table_ref(struct opp_table *opp_table); +struct opp_table *dev_pm_opp_get_opp_table_ref(struct opp_table *opp_table); void dev_pm_opp_put_opp_table(struct opp_table *opp_table); unsigned long dev_pm_opp_get_bw(struct dev_pm_opp *opp, bool peak, int index); @@ -207,7 +207,10 @@ static inline struct opp_table *dev_pm_opp_get_opp_table_indexed(struct device * return ERR_PTR(-EOPNOTSUPP); } -static inline void dev_pm_opp_get_opp_table_ref(struct opp_table *opp_table) {} +static inline struct opp_table *dev_pm_opp_get_opp_table_ref(struct opp_table *opp_table) +{ + return opp_table; +} static inline void dev_pm_opp_put_opp_table(struct opp_table *opp_table) {} |