aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/power/opp/core.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c
index 4c7c6da7a989..2824d3a5e9f0 100644
--- a/drivers/base/power/opp/core.c
+++ b/drivers/base/power/opp/core.c
@@ -1316,7 +1316,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_put_prop_name);
1316 * that this function is *NOT* called under RCU protection or in contexts where 1316 * that this function is *NOT* called under RCU protection or in contexts where
1317 * mutex cannot be locked. 1317 * mutex cannot be locked.
1318 */ 1318 */
1319int dev_pm_opp_set_regulator(struct device *dev, const char *name) 1319struct opp_table *dev_pm_opp_set_regulator(struct device *dev, const char *name)
1320{ 1320{
1321 struct opp_table *opp_table; 1321 struct opp_table *opp_table;
1322 struct regulator *reg; 1322 struct regulator *reg;
@@ -1354,20 +1354,20 @@ int dev_pm_opp_set_regulator(struct device *dev, const char *name)
1354 opp_table->regulator = reg; 1354 opp_table->regulator = reg;
1355 1355
1356 mutex_unlock(&opp_table_lock); 1356 mutex_unlock(&opp_table_lock);
1357 return 0; 1357 return opp_table;
1358 1358
1359err: 1359err:
1360 _remove_opp_table(opp_table); 1360 _remove_opp_table(opp_table);
1361unlock: 1361unlock:
1362 mutex_unlock(&opp_table_lock); 1362 mutex_unlock(&opp_table_lock);
1363 1363
1364 return ret; 1364 return ERR_PTR(ret);
1365} 1365}
1366EXPORT_SYMBOL_GPL(dev_pm_opp_set_regulator); 1366EXPORT_SYMBOL_GPL(dev_pm_opp_set_regulator);
1367 1367
1368/** 1368/**
1369 * dev_pm_opp_put_regulator() - Releases resources blocked for regulator 1369 * dev_pm_opp_put_regulator() - Releases resources blocked for regulator
1370 * @dev: Device for which regulator was set. 1370 * @opp_table: OPP table returned from dev_pm_opp_set_regulator().
1371 * 1371 *
1372 * Locking: The internal opp_table and opp structures are RCU protected. 1372 * Locking: The internal opp_table and opp structures are RCU protected.
1373 * Hence this function internally uses RCU updater strategy with mutex locks 1373 * Hence this function internally uses RCU updater strategy with mutex locks
@@ -1375,22 +1375,12 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_set_regulator);
1375 * that this function is *NOT* called under RCU protection or in contexts where 1375 * that this function is *NOT* called under RCU protection or in contexts where
1376 * mutex cannot be locked. 1376 * mutex cannot be locked.
1377 */ 1377 */
1378void dev_pm_opp_put_regulator(struct device *dev) 1378void dev_pm_opp_put_regulator(struct opp_table *opp_table)
1379{ 1379{
1380 struct opp_table *opp_table;
1381
1382 mutex_lock(&opp_table_lock); 1380 mutex_lock(&opp_table_lock);
1383 1381
1384 /* Check for existing table for 'dev' first */
1385 opp_table = _find_opp_table(dev);
1386 if (IS_ERR(opp_table)) {
1387 dev_err(dev, "Failed to find opp_table: %ld\n",
1388 PTR_ERR(opp_table));
1389 goto unlock;
1390 }
1391
1392 if (IS_ERR(opp_table->regulator)) { 1382 if (IS_ERR(opp_table->regulator)) {
1393 dev_err(dev, "%s: Doesn't have regulator set\n", __func__); 1383 pr_err("%s: Doesn't have regulator set\n", __func__);
1394 goto unlock; 1384 goto unlock;
1395 } 1385 }
1396 1386