Commit 5fedd0afd661cf2d387a6eb1b0df78ddbc0c9086
1 parent
67a6e80ede
Exists in
master
and in
7 other branches
[ARM] clocklib: Allow dynamic alias creation
This patch allows dynamic creation of clock aliases in order to make it possible to have platform independent clock names for use in device drivers. Signed-off-by: Ian Molton <spyro@f2s.com>
Showing 2 changed files with 30 additions and 0 deletions Side-by-side Diff
arch/arm/mach-pxa/clock.c
... | ... | @@ -125,4 +125,29 @@ |
125 | 125 | list_add(&clks[i].node, &clocks); |
126 | 126 | mutex_unlock(&clocks_mutex); |
127 | 127 | } |
128 | + | |
129 | +int clk_add_alias(char *alias, struct device *alias_dev, char *id, | |
130 | + struct device *dev) | |
131 | +{ | |
132 | + struct clk *r = clk_lookup(dev, id); | |
133 | + struct clk *new; | |
134 | + | |
135 | + if (!r) | |
136 | + return -ENODEV; | |
137 | + | |
138 | + new = kzalloc(sizeof(struct clk), GFP_KERNEL); | |
139 | + | |
140 | + if (!new) | |
141 | + return -ENOMEM; | |
142 | + | |
143 | + new->name = alias; | |
144 | + new->dev = alias_dev; | |
145 | + new->other = r; | |
146 | + | |
147 | + mutex_lock(&clocks_mutex); | |
148 | + list_add(&new->node, &clocks); | |
149 | + mutex_unlock(&clocks_mutex); | |
150 | + | |
151 | + return 0; | |
152 | +} |
arch/arm/mach-pxa/clock.h