Skip to content

Commit 83121ec

Browse files
krzkrobherring
authored andcommitted
cpufreq: mediatek: 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. 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-3-d46b72003fd6@linaro.org Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
1 parent 6ea891a commit 83121ec

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

drivers/cpufreq/mediatek-cpufreq.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -764,22 +764,14 @@ MODULE_DEVICE_TABLE(of, mtk_cpufreq_machines);
764764

765765
static int __init mtk_cpufreq_driver_init(void)
766766
{
767-
struct device_node *np;
768-
const struct of_device_id *match;
769767
const struct mtk_cpufreq_platform_data *data;
770768
int err;
771769

772-
np = of_find_node_by_path("/");
773-
if (!np)
774-
return -ENODEV;
775-
776-
match = of_match_node(mtk_cpufreq_machines, np);
777-
of_node_put(np);
778-
if (!match) {
770+
data = of_machine_get_match_data(mtk_cpufreq_machines);
771+
if (!data) {
779772
pr_debug("Machine is not compatible with mtk-cpufreq\n");
780773
return -ENODEV;
781774
}
782-
data = match->data;
783775

784776
err = platform_driver_register(&mtk_cpufreq_platdrv);
785777
if (err)

0 commit comments

Comments
 (0)