Commit ead69494 authored by Viresh Kumar's avatar Viresh Kumar
Browse files

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: default avatarViresh Kumar <viresh.kumar@linaro.org>
parent 7a3be007
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -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);

+3 −6
Original line number Diff line number Diff line
@@ -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);
+5 −2
Original line number Diff line number Diff line
@@ -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) {}