Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PM / OPP: Prefix exported opp routines with dev_pm_opp_

That's the naming convention followed in most of opp core, but few
routines didn't follow this, fix them.

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Viresh Kumar and committed by
Rafael J. Wysocki
8f8d37b2 f0489a5e

+58 -57
+1 -1
arch/arm/mach-imx/mach-imx6q.c
··· 350 350 return; 351 351 } 352 352 353 - if (of_add_opp_table(cpu_dev)) { 353 + if (dev_pm_opp_of_add_table(cpu_dev)) { 354 354 pr_warn("failed to init OPP table\n"); 355 355 goto put_node; 356 356 }
+21 -20
drivers/base/power/opp.c
··· 828 828 * The opp is made available by default and it can be controlled using 829 829 * dev_pm_opp_enable/disable functions and may be removed by dev_pm_opp_remove. 830 830 * 831 - * NOTE: "dynamic" parameter impacts OPPs added by the of_add_opp_table and 832 - * freed by of_remove_opp_table. 831 + * NOTE: "dynamic" parameter impacts OPPs added by the dev_pm_opp_of_add_table 832 + * and freed by dev_pm_opp_of_remove_table. 833 833 * 834 834 * Locking: The internal device_opp and opp structures are RCU protected. 835 835 * Hence this function internally uses RCU updater strategy with mutex locks ··· 1213 1213 1214 1214 #ifdef CONFIG_OF 1215 1215 /** 1216 - * of_remove_opp_table() - Free OPP table entries created from static DT entries 1216 + * dev_pm_opp_of_remove_table() - Free OPP table entries created from static DT 1217 + * entries 1217 1218 * @dev: device pointer used to lookup device OPPs. 1218 1219 * 1219 1220 * Free OPPs created using static entries present in DT. ··· 1225 1224 * that this function is *NOT* called under RCU protection or in contexts where 1226 1225 * mutex cannot be locked. 1227 1226 */ 1228 - void of_remove_opp_table(struct device *dev) 1227 + void dev_pm_opp_of_remove_table(struct device *dev) 1229 1228 { 1230 1229 struct device_opp *dev_opp; 1231 1230 struct dev_pm_opp *opp, *tmp; ··· 1260 1259 unlock: 1261 1260 mutex_unlock(&dev_opp_list_lock); 1262 1261 } 1263 - EXPORT_SYMBOL_GPL(of_remove_opp_table); 1262 + EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table); 1264 1263 1265 - void of_cpumask_remove_opp_table(cpumask_var_t cpumask) 1264 + void dev_pm_opp_of_cpumask_remove_table(cpumask_var_t cpumask) 1266 1265 { 1267 1266 struct device *cpu_dev; 1268 1267 int cpu; ··· 1277 1276 continue; 1278 1277 } 1279 1278 1280 - of_remove_opp_table(cpu_dev); 1279 + dev_pm_opp_of_remove_table(cpu_dev); 1281 1280 } 1282 1281 } 1283 - EXPORT_SYMBOL_GPL(of_cpumask_remove_opp_table); 1282 + EXPORT_SYMBOL_GPL(dev_pm_opp_of_cpumask_remove_table); 1284 1283 1285 1284 /* Returns opp descriptor node for a device, caller must do of_node_put() */ 1286 1285 static struct device_node *_of_get_opp_desc_node(struct device *dev) ··· 1338 1337 return 0; 1339 1338 1340 1339 free_table: 1341 - of_remove_opp_table(dev); 1340 + dev_pm_opp_of_remove_table(dev); 1342 1341 1343 1342 return ret; 1344 1343 } ··· 1381 1380 } 1382 1381 1383 1382 /** 1384 - * of_add_opp_table() - Initialize opp table from device tree 1383 + * dev_pm_opp_of_add_table() - Initialize opp table from device tree 1385 1384 * @dev: device pointer used to lookup device OPPs. 1386 1385 * 1387 1386 * Register the initial OPP table with the OPP library for given device. ··· 1403 1402 * -ENODATA when empty 'operating-points' property is found 1404 1403 * -EINVAL when invalid entries are found in opp-v2 table 1405 1404 */ 1406 - int of_add_opp_table(struct device *dev) 1405 + int dev_pm_opp_of_add_table(struct device *dev) 1407 1406 { 1408 1407 struct device_node *opp_np; 1409 1408 int ret; ··· 1426 1425 1427 1426 return ret; 1428 1427 } 1429 - EXPORT_SYMBOL_GPL(of_add_opp_table); 1428 + EXPORT_SYMBOL_GPL(dev_pm_opp_of_add_table); 1430 1429 1431 - int of_cpumask_add_opp_table(cpumask_var_t cpumask) 1430 + int dev_pm_opp_of_cpumask_add_table(cpumask_var_t cpumask) 1432 1431 { 1433 1432 struct device *cpu_dev; 1434 1433 int cpu, ret = 0; ··· 1443 1442 continue; 1444 1443 } 1445 1444 1446 - ret = of_add_opp_table(cpu_dev); 1445 + ret = dev_pm_opp_of_add_table(cpu_dev); 1447 1446 if (ret) { 1448 1447 pr_err("%s: couldn't find opp table for cpu:%d, %d\n", 1449 1448 __func__, cpu, ret); 1450 1449 1451 1450 /* Free all other OPPs */ 1452 - of_cpumask_remove_opp_table(cpumask); 1451 + dev_pm_opp_of_cpumask_remove_table(cpumask); 1453 1452 break; 1454 1453 } 1455 1454 } 1456 1455 1457 1456 return ret; 1458 1457 } 1459 - EXPORT_SYMBOL_GPL(of_cpumask_add_opp_table); 1458 + EXPORT_SYMBOL_GPL(dev_pm_opp_of_cpumask_add_table); 1460 1459 1461 1460 /* Required only for V1 bindings, as v2 can manage it from DT itself */ 1462 - int set_cpus_sharing_opps(struct device *cpu_dev, cpumask_var_t cpumask) 1461 + int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask) 1463 1462 { 1464 1463 struct device_list_opp *list_dev; 1465 1464 struct device_opp *dev_opp; ··· 1497 1496 1498 1497 return 0; 1499 1498 } 1500 - EXPORT_SYMBOL_GPL(set_cpus_sharing_opps); 1499 + EXPORT_SYMBOL_GPL(dev_pm_opp_set_sharing_cpus); 1501 1500 1502 1501 /* 1503 1502 * Works only for OPP v2 bindings. ··· 1505 1504 * cpumask should be already set to mask of cpu_dev->id. 1506 1505 * Returns -ENOENT if operating-points-v2 bindings aren't supported. 1507 1506 */ 1508 - int of_get_cpus_sharing_opps(struct device *cpu_dev, cpumask_var_t cpumask) 1507 + int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask) 1509 1508 { 1510 1509 struct device_node *np, *tmp_np; 1511 1510 struct device *tcpu_dev; ··· 1555 1554 of_node_put(np); 1556 1555 return ret; 1557 1556 } 1558 - EXPORT_SYMBOL_GPL(of_get_cpus_sharing_opps); 1557 + EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_sharing_cpus); 1559 1558 #endif
+1 -1
drivers/cpufreq/arm_big_little.h
··· 28 28 29 29 /* 30 30 * This must set opp table for cpu_dev in a similar way as done by 31 - * of_add_opp_table(). 31 + * dev_pm_opp_of_add_table(). 32 32 */ 33 33 int (*init_opp_table)(struct device *cpu_dev); 34 34
+2 -2
drivers/cpufreq/arm_big_little_dt.c
··· 54 54 return -ENOENT; 55 55 } 56 56 57 - ret = of_add_opp_table(cpu_dev); 57 + ret = dev_pm_opp_of_add_table(cpu_dev); 58 58 of_node_put(np); 59 59 60 60 return ret; ··· 82 82 .name = "dt-bl", 83 83 .get_transition_latency = dt_get_transition_latency, 84 84 .init_opp_table = dt_init_opp_table, 85 - .free_opp_table = of_remove_opp_table, 85 + .free_opp_table = dev_pm_opp_of_remove_table, 86 86 }; 87 87 88 88 static int generic_bL_probe(struct platform_device *pdev)
+5 -5
drivers/cpufreq/cpufreq-dt.c
··· 216 216 } 217 217 218 218 /* Get OPP-sharing information from "operating-points-v2" bindings */ 219 - ret = of_get_cpus_sharing_opps(cpu_dev, policy->cpus); 219 + ret = dev_pm_opp_of_get_sharing_cpus(cpu_dev, policy->cpus); 220 220 if (ret) { 221 221 /* 222 222 * operating-points-v2 not supported, fallback to old method of ··· 238 238 * 239 239 * OPPs might be populated at runtime, don't check for error here 240 240 */ 241 - of_cpumask_add_opp_table(policy->cpus); 241 + dev_pm_opp_of_cpumask_add_table(policy->cpus); 242 242 243 243 /* 244 244 * But we need OPP table to function so if it is not there let's ··· 261 261 * OPP tables are initialized only for policy->cpu, do it for 262 262 * others as well. 263 263 */ 264 - ret = set_cpus_sharing_opps(cpu_dev, policy->cpus); 264 + ret = dev_pm_opp_set_sharing_cpus(cpu_dev, policy->cpus); 265 265 if (ret) 266 266 dev_err(cpu_dev, "%s: failed to mark OPPs as shared: %d\n", 267 267 __func__, ret); ··· 368 368 out_free_priv: 369 369 kfree(priv); 370 370 out_free_opp: 371 - of_cpumask_remove_opp_table(policy->cpus); 371 + dev_pm_opp_of_cpumask_remove_table(policy->cpus); 372 372 out_node_put: 373 373 of_node_put(np); 374 374 out_put_reg_clk: ··· 385 385 386 386 cpufreq_cooling_unregister(priv->cdev); 387 387 dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); 388 - of_cpumask_remove_opp_table(policy->related_cpus); 388 + dev_pm_opp_of_cpumask_remove_table(policy->related_cpus); 389 389 clk_put(policy->clk); 390 390 if (!IS_ERR(priv->cpu_reg)) 391 391 regulator_put(priv->cpu_reg);
+3 -3
drivers/cpufreq/exynos5440-cpufreq.c
··· 360 360 goto err_put_node; 361 361 } 362 362 363 - ret = of_add_opp_table(dvfs_info->dev); 363 + ret = dev_pm_opp_of_add_table(dvfs_info->dev); 364 364 if (ret) { 365 365 dev_err(dvfs_info->dev, "failed to init OPP table: %d\n", ret); 366 366 goto err_put_node; ··· 424 424 err_free_table: 425 425 dev_pm_opp_free_cpufreq_table(dvfs_info->dev, &dvfs_info->freq_table); 426 426 err_free_opp: 427 - of_remove_opp_table(dvfs_info->dev); 427 + dev_pm_opp_of_remove_table(dvfs_info->dev); 428 428 err_put_node: 429 429 of_node_put(np); 430 430 dev_err(&pdev->dev, "%s: failed initialization\n", __func__); ··· 435 435 { 436 436 cpufreq_unregister_driver(&exynos_driver); 437 437 dev_pm_opp_free_cpufreq_table(dvfs_info->dev, &dvfs_info->freq_table); 438 - of_remove_opp_table(dvfs_info->dev); 438 + dev_pm_opp_of_remove_table(dvfs_info->dev); 439 439 return 0; 440 440 } 441 441
+3 -3
drivers/cpufreq/imx6q-cpufreq.c
··· 202 202 */ 203 203 num = dev_pm_opp_get_opp_count(cpu_dev); 204 204 if (num < 0) { 205 - ret = of_add_opp_table(cpu_dev); 205 + ret = dev_pm_opp_of_add_table(cpu_dev); 206 206 if (ret < 0) { 207 207 dev_err(cpu_dev, "failed to init OPP table: %d\n", ret); 208 208 goto put_reg; ··· 312 312 dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); 313 313 out_free_opp: 314 314 if (free_opp) 315 - of_remove_opp_table(cpu_dev); 315 + dev_pm_opp_of_remove_table(cpu_dev); 316 316 put_reg: 317 317 if (!IS_ERR(arm_reg)) 318 318 regulator_put(arm_reg); ··· 340 340 cpufreq_unregister_driver(&imx6q_cpufreq_driver); 341 341 dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); 342 342 if (free_opp) 343 - of_remove_opp_table(cpu_dev); 343 + dev_pm_opp_of_remove_table(cpu_dev); 344 344 regulator_put(arm_reg); 345 345 if (!IS_ERR(pu_reg)) 346 346 regulator_put(pu_reg);
+3 -3
drivers/cpufreq/mt8173-cpufreq.c
··· 344 344 /* Both presence and absence of sram regulator are valid cases. */ 345 345 sram_reg = regulator_get_exclusive(cpu_dev, "sram"); 346 346 347 - ret = of_add_opp_table(cpu_dev); 347 + ret = dev_pm_opp_of_add_table(cpu_dev); 348 348 if (ret) { 349 349 pr_warn("no OPP table for cpu%d\n", cpu); 350 350 goto out_free_resources; ··· 378 378 return 0; 379 379 380 380 out_free_opp_table: 381 - of_remove_opp_table(cpu_dev); 381 + dev_pm_opp_of_remove_table(cpu_dev); 382 382 383 383 out_free_resources: 384 384 if (!IS_ERR(proc_reg)) ··· 404 404 if (!IS_ERR(info->inter_clk)) 405 405 clk_put(info->inter_clk); 406 406 407 - of_remove_opp_table(info->cpu_dev); 407 + dev_pm_opp_of_remove_table(info->cpu_dev); 408 408 } 409 409 410 410 static int mtk_cpufreq_init(struct cpufreq_policy *policy)
+19 -19
include/linux/pm_opp.h
··· 132 132 #endif /* CONFIG_PM_OPP */ 133 133 134 134 #if defined(CONFIG_PM_OPP) && defined(CONFIG_OF) 135 - int of_add_opp_table(struct device *dev); 136 - void of_remove_opp_table(struct device *dev); 137 - int of_cpumask_add_opp_table(cpumask_var_t cpumask); 138 - void of_cpumask_remove_opp_table(cpumask_var_t cpumask); 139 - int of_get_cpus_sharing_opps(struct device *cpu_dev, cpumask_var_t cpumask); 140 - int set_cpus_sharing_opps(struct device *cpu_dev, cpumask_var_t cpumask); 135 + int dev_pm_opp_of_add_table(struct device *dev); 136 + void dev_pm_opp_of_remove_table(struct device *dev); 137 + int dev_pm_opp_of_cpumask_add_table(cpumask_var_t cpumask); 138 + void dev_pm_opp_of_cpumask_remove_table(cpumask_var_t cpumask); 139 + int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask); 140 + int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask); 141 141 #else 142 - static inline int of_add_opp_table(struct device *dev) 142 + static inline int dev_pm_opp_of_add_table(struct device *dev) 143 143 { 144 144 return -EINVAL; 145 145 } 146 146 147 - static inline void of_remove_opp_table(struct device *dev) 147 + static inline void dev_pm_opp_of_remove_table(struct device *dev) 148 148 { 149 149 } 150 150 151 - static inline int of_cpumask_add_opp_table(cpumask_var_t cpumask) 152 - { 153 - return -ENOSYS; 154 - } 155 - 156 - static inline void of_cpumask_remove_opp_table(cpumask_var_t cpumask) 157 - { 158 - } 159 - 160 - static inline int of_get_cpus_sharing_opps(struct device *cpu_dev, cpumask_var_t cpumask) 151 + static inline int dev_pm_opp_of_cpumask_add_table(cpumask_var_t cpumask) 161 152 { 162 153 return -ENOSYS; 163 154 } 164 155 165 - static inline int set_cpus_sharing_opps(struct device *cpu_dev, cpumask_var_t cpumask) 156 + static inline void dev_pm_opp_of_cpumask_remove_table(cpumask_var_t cpumask) 157 + { 158 + } 159 + 160 + static inline int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask) 161 + { 162 + return -ENOSYS; 163 + } 164 + 165 + static inline int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask) 166 166 { 167 167 return -ENOSYS; 168 168 }