1
0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2026-01-11 17:10:13 +00:00

OPP: Return opp_table from dev_pm_opp_get_opp_table_ref()

For convenience of users, return back the pointer to the opp_table from
dev_pm_opp_get_opp_table_ref(), so they can do:

	opp_table = dev_pm_opp_get_opp_table_ref(tmp_table);

No intentional functional impact.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
Viresh Kumar 2025-04-23 15:48:40 +05:30
parent 7a3be00771
commit ead6949416
3 changed files with 12 additions and 13 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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) {}