diff options
Diffstat (limited to 'arch/arm/mach-pxa/clock.c')
-rw-r--r-- | arch/arm/mach-pxa/clock.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c index 83ef5ecaf432..df5ae2710ab1 100644 --- a/arch/arm/mach-pxa/clock.c +++ b/arch/arm/mach-pxa/clock.c | |||
@@ -23,18 +23,27 @@ static LIST_HEAD(clocks); | |||
23 | static DEFINE_MUTEX(clocks_mutex); | 23 | static DEFINE_MUTEX(clocks_mutex); |
24 | static DEFINE_SPINLOCK(clocks_lock); | 24 | static DEFINE_SPINLOCK(clocks_lock); |
25 | 25 | ||
26 | static struct clk *clk_lookup(struct device *dev, const char *id) | ||
27 | { | ||
28 | struct clk *p; | ||
29 | |||
30 | list_for_each_entry(p, &clocks, node) | ||
31 | if (strcmp(id, p->name) == 0 && p->dev == dev) | ||
32 | return p; | ||
33 | |||
34 | return NULL; | ||
35 | } | ||
36 | |||
26 | struct clk *clk_get(struct device *dev, const char *id) | 37 | struct clk *clk_get(struct device *dev, const char *id) |
27 | { | 38 | { |
28 | struct clk *p, *clk = ERR_PTR(-ENOENT); | 39 | struct clk *p, *clk = ERR_PTR(-ENOENT); |
29 | 40 | ||
30 | mutex_lock(&clocks_mutex); | 41 | mutex_lock(&clocks_mutex); |
31 | list_for_each_entry(p, &clocks, node) { | 42 | p = clk_lookup(dev, id); |
32 | if (strcmp(id, p->name) == 0 && | 43 | if (!p) |
33 | (p->dev == NULL || p->dev == dev)) { | 44 | p = clk_lookup(NULL, id); |
34 | clk = p; | 45 | if (p) |
35 | break; | 46 | clk = p; |
36 | } | ||
37 | } | ||
38 | mutex_unlock(&clocks_mutex); | 47 | mutex_unlock(&clocks_mutex); |
39 | 48 | ||
40 | return clk; | 49 | return clk; |