Skip to content

Commit 599ff56

Browse files
krzkrobherring
authored andcommitted
powercap: dtpm: Simplify with of_machine_get_match_data()
Replace open-coded getting root OF node, matching against it and getting the match data with new of_machine_get_match_data() helper. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://patch.msgid.link/20251112-b4-of-match-matchine-data-v2-9-d46b72003fd6@linaro.org Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
1 parent fa622c9 commit 599ff56

1 file changed

Lines changed: 1 addition & 15 deletions

File tree

drivers/powercap/dtpm.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -548,9 +548,7 @@ static int dtpm_for_each_child(const struct dtpm_node *hierarchy,
548548
*/
549549
int dtpm_create_hierarchy(struct of_device_id *dtpm_match_table)
550550
{
551-
const struct of_device_id *match;
552551
const struct dtpm_node *hierarchy;
553-
struct device_node *np;
554552
int i, ret;
555553

556554
mutex_lock(&dtpm_lock);
@@ -567,19 +565,7 @@ int dtpm_create_hierarchy(struct of_device_id *dtpm_match_table)
567565
goto out_pct;
568566
}
569567

570-
ret = -ENODEV;
571-
np = of_find_node_by_path("/");
572-
if (!np)
573-
goto out_err;
574-
575-
match = of_match_node(dtpm_match_table, np);
576-
577-
of_node_put(np);
578-
579-
if (!match)
580-
goto out_err;
581-
582-
hierarchy = match->data;
568+
hierarchy = of_machine_get_match_data(dtpm_match_table);
583569
if (!hierarchy) {
584570
ret = -EFAULT;
585571
goto out_err;

0 commit comments

Comments
 (0)