Commit 1ead1349 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Rob Herring (Arm)
Browse files

cpufreq: sun50i: Simplify with of_machine_device_match()



Replace open-coded getting root OF node and matching against it with
new of_machine_device_match() helper.

Acked-by: default avatarChen-Yu Tsai <wens@kernel.org>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: default avatarAngeloGioacchino 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: default avatarRob Herring (Arm) <robh@kernel.org>
parent 83121ec1
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -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);