]> Gentwo Git Trees - linux/.git/commitdiff
cpufreq: sun50i: Simplify with of_machine_device_match()
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Wed, 12 Nov 2025 10:28:49 +0000 (11:28 +0100)
committerRob Herring (Arm) <robh@kernel.org>
Thu, 27 Nov 2025 01:42:30 +0000 (19:42 -0600)
Replace open-coded getting root OF node and matching against it with
new of_machine_device_match() helper.

Acked-by: Chen-Yu Tsai <wens@kernel.org>
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>
Link: https://patch.msgid.link/20251112-b4-of-match-matchine-data-v2-4-d46b72003fd6@linaro.org
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
drivers/cpufreq/sun50i-cpufreq-nvmem.c

index 744312a44279cb48bca2994407fac02b2b3860c6..4fffc8e83692e71433947b78633193dabc11fd68 100644 (file)
@@ -332,13 +332,6 @@ static const struct of_device_id sun50i_cpufreq_match_list[] = {
 };
 MODULE_DEVICE_TABLE(of, sun50i_cpufreq_match_list);
 
-static const struct of_device_id *sun50i_cpufreq_match_node(void)
-{
-       struct device_node *np __free(device_node) = of_find_node_by_path("/");
-
-       return of_match_node(sun50i_cpufreq_match_list, np);
-}
-
 /*
  * Since the driver depends on nvmem drivers, which may return EPROBE_DEFER,
  * all the real activity is done in the probe, which may be defered as well.
@@ -346,11 +339,9 @@ static const struct of_device_id *sun50i_cpufreq_match_node(void)
  */
 static int __init sun50i_cpufreq_init(void)
 {
-       const struct of_device_id *match;
        int ret;
 
-       match = sun50i_cpufreq_match_node();
-       if (!match)
+       if (!of_machine_device_match(sun50i_cpufreq_match_list))
                return -ENODEV;
 
        ret = platform_driver_register(&sun50i_cpufreq_driver);