| .. | .. |
|---|
| 1 | | -/* |
|---|
| 2 | | - * clk-max77686.c - Clock driver for Maxim 77686/MAX77802 |
|---|
| 3 | | - * |
|---|
| 4 | | - * Copyright (C) 2012 Samsung Electornics |
|---|
| 5 | | - * Jonghwa Lee <jonghwa3.lee@samsung.com> |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 8 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 9 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 10 | | - * option) any later version. |
|---|
| 11 | | - * |
|---|
| 12 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 13 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | | - * GNU General Public License for more details. |
|---|
| 16 | | - * |
|---|
| 17 | | - * You should have received a copy of the GNU General Public License |
|---|
| 18 | | - * along with this program; if not, write to the Free Software |
|---|
| 19 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 20 | | - * |
|---|
| 21 | | - */ |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0+ |
|---|
| 2 | +// |
|---|
| 3 | +// clk-max77686.c - Clock driver for Maxim 77686/MAX77802 |
|---|
| 4 | +// |
|---|
| 5 | +// Copyright (C) 2012 Samsung Electornics |
|---|
| 6 | +// Jonghwa Lee <jonghwa3.lee@samsung.com> |
|---|
| 22 | 7 | |
|---|
| 23 | 8 | #include <linux/kernel.h> |
|---|
| 24 | 9 | #include <linux/slab.h> |
|---|
| .. | .. |
|---|
| 152 | 137 | return 32768; |
|---|
| 153 | 138 | } |
|---|
| 154 | 139 | |
|---|
| 155 | | -static struct clk_ops max77686_clk_ops = { |
|---|
| 140 | +static const struct clk_ops max77686_clk_ops = { |
|---|
| 156 | 141 | .prepare = max77686_clk_prepare, |
|---|
| 157 | 142 | .unprepare = max77686_clk_unprepare, |
|---|
| 158 | 143 | .is_prepared = max77686_clk_is_prepared, |
|---|
| .. | .. |
|---|
| 250 | 235 | return ret; |
|---|
| 251 | 236 | } |
|---|
| 252 | 237 | |
|---|
| 253 | | - ret = clk_hw_register_clkdev(&max_clk_data->hw, |
|---|
| 254 | | - max_clk_data->clk_idata.name, NULL); |
|---|
| 238 | + ret = devm_clk_hw_register_clkdev(dev, &max_clk_data->hw, |
|---|
| 239 | + max_clk_data->clk_idata.name, |
|---|
| 240 | + NULL); |
|---|
| 255 | 241 | if (ret < 0) { |
|---|
| 256 | 242 | dev_err(dev, "Failed to clkdev register: %d\n", ret); |
|---|
| 257 | 243 | return ret; |
|---|
| .. | .. |
|---|
| 259 | 245 | } |
|---|
| 260 | 246 | |
|---|
| 261 | 247 | if (parent->of_node) { |
|---|
| 262 | | - ret = of_clk_add_hw_provider(parent->of_node, of_clk_max77686_get, |
|---|
| 263 | | - drv_data); |
|---|
| 248 | + ret = devm_of_clk_add_hw_provider(dev, of_clk_max77686_get, |
|---|
| 249 | + drv_data); |
|---|
| 264 | 250 | |
|---|
| 265 | 251 | if (ret < 0) { |
|---|
| 266 | 252 | dev_err(dev, "Failed to register OF clock provider: %d\n", |
|---|
| .. | .. |
|---|
| 276 | 262 | 1 << MAX77802_CLOCK_LOW_JITTER_SHIFT); |
|---|
| 277 | 263 | if (ret < 0) { |
|---|
| 278 | 264 | dev_err(dev, "Failed to config low-jitter: %d\n", ret); |
|---|
| 279 | | - goto remove_of_clk_provider; |
|---|
| 265 | + return ret; |
|---|
| 280 | 266 | } |
|---|
| 281 | 267 | } |
|---|
| 282 | | - |
|---|
| 283 | | - return 0; |
|---|
| 284 | | - |
|---|
| 285 | | -remove_of_clk_provider: |
|---|
| 286 | | - if (parent->of_node) |
|---|
| 287 | | - of_clk_del_provider(parent->of_node); |
|---|
| 288 | | - |
|---|
| 289 | | - return ret; |
|---|
| 290 | | -} |
|---|
| 291 | | - |
|---|
| 292 | | -static int max77686_clk_remove(struct platform_device *pdev) |
|---|
| 293 | | -{ |
|---|
| 294 | | - struct device *parent = pdev->dev.parent; |
|---|
| 295 | | - |
|---|
| 296 | | - if (parent->of_node) |
|---|
| 297 | | - of_clk_del_provider(parent->of_node); |
|---|
| 298 | 268 | |
|---|
| 299 | 269 | return 0; |
|---|
| 300 | 270 | } |
|---|
| .. | .. |
|---|
| 312 | 282 | .name = "max77686-clk", |
|---|
| 313 | 283 | }, |
|---|
| 314 | 284 | .probe = max77686_clk_probe, |
|---|
| 315 | | - .remove = max77686_clk_remove, |
|---|
| 316 | 285 | .id_table = max77686_clk_id, |
|---|
| 317 | 286 | }; |
|---|
| 318 | 287 | |
|---|