]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cpufreq: mediatek: Simplify with of_machine_get_match_data()
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Wed, 12 Nov 2025 10:28:48 +0000 (11:28 +0100)
committerRob Herring (Arm) <robh@kernel.org>
Thu, 27 Nov 2025 01:42:21 +0000 (19:42 -0600)
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>
drivers/cpufreq/mediatek-cpufreq.c

index 5d50a231f94441871ca6ae2d4e6491b006488c1d..052ca7cd2f4fd891f05156895ace4a8508b5f251 100644 (file)
@@ -764,22 +764,14 @@ MODULE_DEVICE_TABLE(of, mtk_cpufreq_machines);
 
 static int __init mtk_cpufreq_driver_init(void)
 {
-       struct device_node *np;
-       const struct of_device_id *match;
        const struct mtk_cpufreq_platform_data *data;
        int err;
 
-       np = of_find_node_by_path("/");
-       if (!np)
-               return -ENODEV;
-
-       match = of_match_node(mtk_cpufreq_machines, np);
-       of_node_put(np);
-       if (!match) {
+       data = of_machine_get_match_data(mtk_cpufreq_machines);
+       if (!data) {
                pr_debug("Machine is not compatible with mtk-cpufreq\n");
                return -ENODEV;
        }
-       data = match->data;
 
        err = platform_driver_register(&mtk_cpufreq_platdrv);
        if (err)