diff options
author | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2009-03-27 16:14:38 +0100 |
---|---|---|
committer | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2009-03-27 16:14:38 +0100 |
commit | b92efa9abffc4a634cd2e7a0f81f8aa6310d67c9 (patch) | |
tree | 9847508d9b8d4e585f90db4a453bfbc3700c997e /arch/arm/common/clkdev.c | |
parent | a16fffdd8eb95ebab7dc22414896fe6493951e0e (diff) | |
parent | be0ea69674ed95e1e98cb3687a241badc756d228 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into avr32-arch
Diffstat (limited to 'arch/arm/common/clkdev.c')
-rw-r--r-- | arch/arm/common/clkdev.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/arch/arm/common/clkdev.c b/arch/arm/common/clkdev.c index 17a17b49a45..1037bba1832 100644 --- a/arch/arm/common/clkdev.c +++ b/arch/arm/common/clkdev.c @@ -24,6 +24,15 @@ static LIST_HEAD(clocks); static DEFINE_MUTEX(clocks_mutex); +/* + * Find the correct struct clk for the device and connection ID. + * We do slightly fuzzy matching here: + * An entry with a NULL ID is assumed to be a wildcard. + * If an entry has a device ID, it must match + * If an entry has a connection ID, it must match + * Then we take the most specific entry - with the following + * order of precidence: dev+con > dev only > con only. + */ static struct clk *clk_find(const char *dev_id, const char *con_id) { struct clk_lookup *p; @@ -31,13 +40,17 @@ static struct clk *clk_find(const char *dev_id, const char *con_id) int match, best = 0; list_for_each_entry(p, &clocks, node) { - if ((p->dev_id && !dev_id) || (p->con_id && !con_id)) - continue; match = 0; - if (p->dev_id) - match += 2 * (strcmp(p->dev_id, dev_id) == 0); - if (p->con_id) - match += 1 * (strcmp(p->con_id, con_id) == 0); + if (p->dev_id) { + if (!dev_id || strcmp(p->dev_id, dev_id)) + continue; + match += 2; + } + if (p->con_id) { + if (!con_id || strcmp(p->con_id, con_id)) + continue; + match += 1; + } if (match == 0) continue; |