summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/clock.c
diff options
context:
space:
mode:
authorIan Molton <spyro@f2s.com>2008-07-25 12:02:31 +0100
committerIan Molton <spyro@f2s.com>2008-08-12 12:54:30 +0100
commit5fedd0afd661cf2d387a6eb1b0df78ddbc0c9086 (patch)
treebd9055f838a9cd90fed0a19f226d51e5e2519232 /arch/arm/mach-pxa/clock.c
parent67a6e80ede815224db22518cd08350277bbeddb9 (diff)
downloadop-kernel-dev-5fedd0afd661cf2d387a6eb1b0df78ddbc0c9086.zip
op-kernel-dev-5fedd0afd661cf2d387a6eb1b0df78ddbc0c9086.tar.gz
[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>
Diffstat (limited to 'arch/arm/mach-pxa/clock.c')
-rw-r--r--arch/arm/mach-pxa/clock.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c
index c01eea8..ca8e205 100644
--- a/arch/arm/mach-pxa/clock.c
+++ b/arch/arm/mach-pxa/clock.c
@@ -125,3 +125,28 @@ void clks_register(struct clk *clks, size_t num)
list_add(&clks[i].node, &clocks);
mutex_unlock(&clocks_mutex);
}
+
+int clk_add_alias(char *alias, struct device *alias_dev, char *id,
+ struct device *dev)
+{
+ struct clk *r = clk_lookup(dev, id);
+ struct clk *new;
+
+ if (!r)
+ return -ENODEV;
+
+ new = kzalloc(sizeof(struct clk), GFP_KERNEL);
+
+ if (!new)
+ return -ENOMEM;
+
+ new->name = alias;
+ new->dev = alias_dev;
+ new->other = r;
+
+ mutex_lock(&clocks_mutex);
+ list_add(&new->node, &clocks);
+ mutex_unlock(&clocks_mutex);
+
+ return 0;
+}
OpenPOWER on IntegriCloud