Skip to content

Commit 6ea891a

Browse files
krzkrobherring
authored andcommitted
cpufreq: dt-platdev: Simplify with of_machine_get_match_data()
Replace open-coded getting root OF node, matching against it and getting the match data with two new helpers: of_machine_get_match_data() and of_machine_device_match(). Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> 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-2-d46b72003fd6@linaro.org Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
1 parent 4a93adc commit 6ea891a

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

drivers/cpufreq/cpufreq-dt-platdev.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -218,20 +218,13 @@ static bool __init cpu0_node_has_opp_v2_prop(void)
218218

219219
static int __init cpufreq_dt_platdev_init(void)
220220
{
221-
struct device_node *np __free(device_node) = of_find_node_by_path("/");
222-
const struct of_device_id *match;
223-
const void *data = NULL;
221+
const void *data;
224222

225-
if (!np)
226-
return -ENODEV;
227-
228-
match = of_match_node(allowlist, np);
229-
if (match) {
230-
data = match->data;
223+
data = of_machine_get_match_data(allowlist);
224+
if (data)
231225
goto create_pdev;
232-
}
233226

234-
if (cpu0_node_has_opp_v2_prop() && !of_match_node(blocklist, np))
227+
if (cpu0_node_has_opp_v2_prop() && !of_machine_device_match(blocklist))
235228
goto create_pdev;
236229

237230
return -ENODEV;

0 commit comments

Comments
 (0)