| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2013 Freescale Semiconductor, Inc. |
|---|
| 3 | | - * |
|---|
| 4 | | - * The code contained herein is licensed under the GNU General Public |
|---|
| 5 | | - * License. You may obtain a copy of the GNU General Public License |
|---|
| 6 | | - * Version 2 or later at the following locations: |
|---|
| 7 | | - * |
|---|
| 8 | | - * http://www.opensource.org/licenses/gpl-license.html |
|---|
| 9 | | - * http://www.gnu.org/copyleft/gpl.html |
|---|
| 10 | 4 | */ |
|---|
| 11 | 5 | |
|---|
| 12 | 6 | #include <linux/clk-provider.h> |
|---|
| .. | .. |
|---|
| 61 | 55 | struct clk_fixup_div *fixup_div = to_clk_fixup_div(hw); |
|---|
| 62 | 56 | struct clk_divider *div = to_clk_divider(hw); |
|---|
| 63 | 57 | unsigned int divider, value; |
|---|
| 64 | | - unsigned long flags = 0; |
|---|
| 58 | + unsigned long flags; |
|---|
| 65 | 59 | u32 val; |
|---|
| 66 | 60 | |
|---|
| 67 | 61 | divider = parent_rate / rate; |
|---|
| .. | .. |
|---|
| 91 | 85 | .set_rate = clk_fixup_div_set_rate, |
|---|
| 92 | 86 | }; |
|---|
| 93 | 87 | |
|---|
| 94 | | -struct clk *imx_clk_fixup_divider(const char *name, const char *parent, |
|---|
| 88 | +struct clk_hw *imx_clk_hw_fixup_divider(const char *name, const char *parent, |
|---|
| 95 | 89 | void __iomem *reg, u8 shift, u8 width, |
|---|
| 96 | 90 | void (*fixup)(u32 *val)) |
|---|
| 97 | 91 | { |
|---|
| 98 | 92 | struct clk_fixup_div *fixup_div; |
|---|
| 99 | | - struct clk *clk; |
|---|
| 100 | | - struct clk_init_data init = {}; |
|---|
| 93 | + struct clk_hw *hw; |
|---|
| 94 | + struct clk_init_data init; |
|---|
| 95 | + int ret; |
|---|
| 101 | 96 | |
|---|
| 102 | 97 | if (!fixup) |
|---|
| 103 | 98 | return ERR_PTR(-EINVAL); |
|---|
| .. | .. |
|---|
| 120 | 115 | fixup_div->ops = &clk_divider_ops; |
|---|
| 121 | 116 | fixup_div->fixup = fixup; |
|---|
| 122 | 117 | |
|---|
| 123 | | - clk = clk_register(NULL, &fixup_div->divider.hw); |
|---|
| 124 | | - if (IS_ERR(clk)) |
|---|
| 125 | | - kfree(fixup_div); |
|---|
| 118 | + hw = &fixup_div->divider.hw; |
|---|
| 126 | 119 | |
|---|
| 127 | | - return clk; |
|---|
| 120 | + ret = clk_hw_register(NULL, hw); |
|---|
| 121 | + if (ret) { |
|---|
| 122 | + kfree(fixup_div); |
|---|
| 123 | + return ERR_PTR(ret); |
|---|
| 124 | + } |
|---|
| 125 | + |
|---|
| 126 | + return hw; |
|---|
| 128 | 127 | } |
|---|