Skip to content

Commit 1ead134

Browse files
krzkrobherring
authored andcommitted
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: 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>
1 parent 83121ec commit 1ead134

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

drivers/cpufreq/sun50i-cpufreq-nvmem.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -332,25 +332,16 @@ static const struct of_device_id sun50i_cpufreq_match_list[] = {
332332
};
333333
MODULE_DEVICE_TABLE(of, sun50i_cpufreq_match_list);
334334

335-
static const struct of_device_id *sun50i_cpufreq_match_node(void)
336-
{
337-
struct device_node *np __free(device_node) = of_find_node_by_path("/");
338-
339-
return of_match_node(sun50i_cpufreq_match_list, np);
340-
}
341-
342335
/*
343336
* Since the driver depends on nvmem drivers, which may return EPROBE_DEFER,
344337
* all the real activity is done in the probe, which may be defered as well.
345338
* The init here is only registering the driver and the platform device.
346339
*/
347340
static int __init sun50i_cpufreq_init(void)
348341
{
349-
const struct of_device_id *match;
350342
int ret;
351343

352-
match = sun50i_cpufreq_match_node();
353-
if (!match)
344+
if (!of_machine_device_match(sun50i_cpufreq_match_list))
354345
return -ENODEV;
355346

356347
ret = platform_driver_register(&sun50i_cpufreq_driver);

0 commit comments

Comments
 (0)