diff options
Diffstat (limited to 'drivers/clk/clk-mux.c')
-rw-r--r-- | drivers/clk/clk-mux.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index c71ad1f41a97..fd36a8ea73d9 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c | |||
@@ -55,7 +55,6 @@ static u8 clk_mux_get_parent(struct clk_hw *hw) | |||
55 | 55 | ||
56 | return val; | 56 | return val; |
57 | } | 57 | } |
58 | EXPORT_SYMBOL_GPL(clk_mux_get_parent); | ||
59 | 58 | ||
60 | static int clk_mux_set_parent(struct clk_hw *hw, u8 index) | 59 | static int clk_mux_set_parent(struct clk_hw *hw, u8 index) |
61 | { | 60 | { |
@@ -82,35 +81,47 @@ static int clk_mux_set_parent(struct clk_hw *hw, u8 index) | |||
82 | 81 | ||
83 | return 0; | 82 | return 0; |
84 | } | 83 | } |
85 | EXPORT_SYMBOL_GPL(clk_mux_set_parent); | ||
86 | 84 | ||
87 | struct clk_ops clk_mux_ops = { | 85 | const struct clk_ops clk_mux_ops = { |
88 | .get_parent = clk_mux_get_parent, | 86 | .get_parent = clk_mux_get_parent, |
89 | .set_parent = clk_mux_set_parent, | 87 | .set_parent = clk_mux_set_parent, |
90 | }; | 88 | }; |
91 | EXPORT_SYMBOL_GPL(clk_mux_ops); | 89 | EXPORT_SYMBOL_GPL(clk_mux_ops); |
92 | 90 | ||
93 | struct clk *clk_register_mux(struct device *dev, const char *name, | 91 | struct clk *clk_register_mux(struct device *dev, const char *name, |
94 | char **parent_names, u8 num_parents, unsigned long flags, | 92 | const char **parent_names, u8 num_parents, unsigned long flags, |
95 | void __iomem *reg, u8 shift, u8 width, | 93 | void __iomem *reg, u8 shift, u8 width, |
96 | u8 clk_mux_flags, spinlock_t *lock) | 94 | u8 clk_mux_flags, spinlock_t *lock) |
97 | { | 95 | { |
98 | struct clk_mux *mux; | 96 | struct clk_mux *mux; |
97 | struct clk *clk; | ||
98 | struct clk_init_data init; | ||
99 | 99 | ||
100 | mux = kmalloc(sizeof(struct clk_mux), GFP_KERNEL); | 100 | /* allocate the mux */ |
101 | 101 | mux = kzalloc(sizeof(struct clk_mux), GFP_KERNEL); | |
102 | if (!mux) { | 102 | if (!mux) { |
103 | pr_err("%s: could not allocate mux clk\n", __func__); | 103 | pr_err("%s: could not allocate mux clk\n", __func__); |
104 | return ERR_PTR(-ENOMEM); | 104 | return ERR_PTR(-ENOMEM); |
105 | } | 105 | } |
106 | 106 | ||
107 | init.name = name; | ||
108 | init.ops = &clk_mux_ops; | ||
109 | init.flags = flags; | ||
110 | init.parent_names = parent_names; | ||
111 | init.num_parents = num_parents; | ||
112 | |||
107 | /* struct clk_mux assignments */ | 113 | /* struct clk_mux assignments */ |
108 | mux->reg = reg; | 114 | mux->reg = reg; |
109 | mux->shift = shift; | 115 | mux->shift = shift; |
110 | mux->width = width; | 116 | mux->width = width; |
111 | mux->flags = clk_mux_flags; | 117 | mux->flags = clk_mux_flags; |
112 | mux->lock = lock; | 118 | mux->lock = lock; |
119 | mux->hw.init = &init; | ||
120 | |||
121 | clk = clk_register(dev, &mux->hw); | ||
122 | |||
123 | if (IS_ERR(clk)) | ||
124 | kfree(mux); | ||
113 | 125 | ||
114 | return clk_register(dev, name, &clk_mux_ops, &mux->hw, | 126 | return clk; |
115 | parent_names, num_parents, flags); | ||
116 | } | 127 | } |