| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 3 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 4 | | - * published by the Free Software Foundation. |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 7 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 8 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 9 | | - * GNU General Public License for more details. |
|---|
| 10 | 3 | * |
|---|
| 11 | 4 | * Copyright (C) 2012 ARM Limited |
|---|
| 12 | 5 | */ |
|---|
| .. | .. |
|---|
| 14 | 7 | #include <linux/clkdev.h> |
|---|
| 15 | 8 | #include <linux/clk-provider.h> |
|---|
| 16 | 9 | #include <linux/err.h> |
|---|
| 10 | +#include <linux/module.h> |
|---|
| 17 | 11 | #include <linux/of.h> |
|---|
| 18 | 12 | #include <linux/platform_device.h> |
|---|
| 19 | 13 | #include <linux/slab.h> |
|---|
| .. | .. |
|---|
| 70 | 64 | |
|---|
| 71 | 65 | static int vexpress_osc_probe(struct platform_device *pdev) |
|---|
| 72 | 66 | { |
|---|
| 73 | | - struct clk_init_data init = {}; |
|---|
| 67 | + struct clk_init_data init; |
|---|
| 74 | 68 | struct vexpress_osc *osc; |
|---|
| 75 | | - struct clk *clk; |
|---|
| 76 | 69 | u32 range[2]; |
|---|
| 70 | + int ret; |
|---|
| 77 | 71 | |
|---|
| 78 | 72 | osc = devm_kzalloc(&pdev->dev, sizeof(*osc), GFP_KERNEL); |
|---|
| 79 | 73 | if (!osc) |
|---|
| .. | .. |
|---|
| 99 | 93 | |
|---|
| 100 | 94 | osc->hw.init = &init; |
|---|
| 101 | 95 | |
|---|
| 102 | | - clk = clk_register(NULL, &osc->hw); |
|---|
| 103 | | - if (IS_ERR(clk)) |
|---|
| 104 | | - return PTR_ERR(clk); |
|---|
| 96 | + ret = devm_clk_hw_register(&pdev->dev, &osc->hw); |
|---|
| 97 | + if (ret < 0) |
|---|
| 98 | + return ret; |
|---|
| 105 | 99 | |
|---|
| 106 | | - of_clk_add_provider(pdev->dev.of_node, of_clk_src_simple_get, clk); |
|---|
| 100 | + devm_of_clk_add_hw_provider(&pdev->dev, of_clk_hw_simple_get, &osc->hw); |
|---|
| 107 | 101 | clk_hw_set_rate_range(&osc->hw, osc->rate_min, osc->rate_max); |
|---|
| 108 | 102 | |
|---|
| 109 | 103 | dev_dbg(&pdev->dev, "Registered clock '%s'\n", init.name); |
|---|
| .. | .. |
|---|
| 115 | 109 | { .compatible = "arm,vexpress-osc", }, |
|---|
| 116 | 110 | {} |
|---|
| 117 | 111 | }; |
|---|
| 112 | +MODULE_DEVICE_TABLE(of, vexpress_osc_of_match); |
|---|
| 118 | 113 | |
|---|
| 119 | 114 | static struct platform_driver vexpress_osc_driver = { |
|---|
| 120 | 115 | .driver = { |
|---|
| .. | .. |
|---|
| 123 | 118 | }, |
|---|
| 124 | 119 | .probe = vexpress_osc_probe, |
|---|
| 125 | 120 | }; |
|---|
| 126 | | - |
|---|
| 127 | | -static int __init vexpress_osc_init(void) |
|---|
| 128 | | -{ |
|---|
| 129 | | - return platform_driver_register(&vexpress_osc_driver); |
|---|
| 130 | | -} |
|---|
| 131 | | -core_initcall(vexpress_osc_init); |
|---|
| 121 | +module_platform_driver(vexpress_osc_driver); |
|---|
| 122 | +MODULE_LICENSE("GPL v2"); |
|---|