From a4471477e837b1b1c47a502bc7c7a036fb47b7c8 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 24 Jan 2009 10:14:37 +0000 Subject: [PATCH] --- yaml --- r: 130239 b: refs/heads/master c: 409dc360b49480b57869ffd457e4b95901b76b75 h: refs/heads/master i: 130237: 77e94b35dfdfdfde00e1368b9c70c929cf74f7ea 130235: 995164bf44e4b8135d73422d03478ddeb4ae29c6 130231: 080962f99aecfb45d780441a9b1bac5e96ac1a10 130223: 63ea3d5d95200a4a7209595e1691e924186fe943 130207: b37ebf4938a078febcc6b5060542a8079574970b 130175: 84f8b348eabeba748a5051e789d95fc58e6eb0b4 v: v3 --- [refs] | 2 +- trunk/arch/arm/common/clkdev.c | 25 +++++++++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 896be93ce33a..cb438f946b97 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 02e0746ecc0e72482fe6f350cbb8b65d1d5fc40a +refs/heads/master: 409dc360b49480b57869ffd457e4b95901b76b75 diff --git a/trunk/arch/arm/common/clkdev.c b/trunk/arch/arm/common/clkdev.c index 17a17b49a45b..1037bba18329 100644 --- a/trunk/arch/arm/common/clkdev.c +++ b/trunk/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;