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

OPP: Drop redundant code in _link_required_opps()

Due to that the required-devs for the required OPPs are now always being
assigned, we no longer need the special treatment in _link_required_opps()
for the single PM domain case. Let's therefore drop it.

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Link: https://lore.kernel.org/r/20241002122232.194245-8-ulf.hansson@linaro.org

+3 -36
+3 -36
drivers/opp/of.c
··· 295 295 of_node_put(opp->np); 296 296 } 297 297 298 - static int _link_required_opps(struct dev_pm_opp *opp, struct opp_table *opp_table, 298 + static int _link_required_opps(struct dev_pm_opp *opp, 299 299 struct opp_table *required_table, int index) 300 300 { 301 301 struct device_node *np; ··· 311 311 pr_err("%s: Unable to find required OPP node: %pOF (%d)\n", 312 312 __func__, opp->np, index); 313 313 return -ENODEV; 314 - } 315 - 316 - /* 317 - * There are two genpd (as required-opp) cases that we need to handle, 318 - * devices with a single genpd and ones with multiple genpds. 319 - * 320 - * The single genpd case requires special handling as we need to use the 321 - * same `dev` structure (instead of a virtual one provided by genpd 322 - * core) for setting the performance state. 323 - * 324 - * It doesn't make sense for a device's DT entry to have both 325 - * "opp-level" and single "required-opps" entry pointing to a genpd's 326 - * OPP, as that would make the OPP core call 327 - * dev_pm_domain_set_performance_state() for two different values for 328 - * the same device structure. Lets treat single genpd configuration as a 329 - * case where the OPP's level is directly available without required-opp 330 - * link in the DT. 331 - * 332 - * Just update the `level` with the right value, which 333 - * dev_pm_opp_set_opp() will take care of in the normal path itself. 334 - * 335 - * There is another case though, where a genpd's OPP table has 336 - * required-opps set to a parent genpd. The OPP core expects the user to 337 - * set the respective required `struct device` pointer via 338 - * dev_pm_opp_set_config(). 339 - */ 340 - if (required_table->is_genpd && opp_table->required_opp_count == 1 && 341 - !opp_table->required_devs[0]) { 342 - /* Genpd core takes care of propagation to parent genpd */ 343 - if (!opp_table->is_genpd) { 344 - if (!WARN_ON(opp->level != OPP_LEVEL_UNSET)) 345 - opp->level = opp->required_opps[0]->level; 346 - } 347 314 } 348 315 349 316 return 0; ··· 337 370 if (IS_ERR_OR_NULL(required_table)) 338 371 continue; 339 372 340 - ret = _link_required_opps(opp, opp_table, required_table, i); 373 + ret = _link_required_opps(opp, required_table, i); 341 374 if (ret) 342 375 goto free_required_opps; 343 376 } ··· 358 391 int ret; 359 392 360 393 list_for_each_entry(opp, &opp_table->opp_list, node) { 361 - ret = _link_required_opps(opp, opp_table, new_table, index); 394 + ret = _link_required_opps(opp, new_table, index); 362 395 if (ret) 363 396 return ret; 364 397 }