* [PATCH] CLKDEV: Reduce scaning time
@ 2011-09-16 14:14 Jonghwan Choi
2011-09-19 11:13 ` Russell King - ARM Linux
0 siblings, 1 reply; 2+ messages in thread
From: Jonghwan Choi @ 2011-09-16 14:14 UTC (permalink / raw)
To: linux-arm-kernel
If ether dev_id or con_id is NULL. it is not necessary that match point should be 3.
it just takes a long time.
Signed-off-by: Jonghwan Choi <jhbird.choi@gmail.com>
---
drivers/clk/clkdev.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
index 6db161f..d1fcb67 100644
--- a/drivers/clk/clkdev.c
+++ b/drivers/clk/clkdev.c
@@ -35,7 +35,13 @@ static DEFINE_MUTEX(clocks_mutex);
static struct clk_lookup *clk_find(const char *dev_id, const char *con_id)
{
struct clk_lookup *p, *cl = NULL;
- int match, best = 0;
+ int match, best = 0, point = 0;
+
+ if (dev_id)
+ point += 2;
+
+ if (con_id)
+ point += 1;
list_for_each_entry(p, &clocks, node) {
match = 0;
@@ -52,10 +58,10 @@ static struct clk_lookup *clk_find(const char *dev_id, const char *con_id)
if (match > best) {
cl = p;
- if (match != 3)
- best = match;
- else
+ if (match == point)
break;
+ else
+ best = match;
}
}
return cl;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] CLKDEV: Reduce scaning time
2011-09-16 14:14 [PATCH] CLKDEV: Reduce scaning time Jonghwan Choi
@ 2011-09-19 11:13 ` Russell King - ARM Linux
0 siblings, 0 replies; 2+ messages in thread
From: Russell King - ARM Linux @ 2011-09-19 11:13 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Sep 16, 2011 at 11:14:12PM +0900, Jonghwan Choi wrote:
> If ether dev_id or con_id is NULL. it is not necessary that match point
> should be 3. it just takes a long time.
clk_get() shouldn't be used in fast paths anyway - drivers should 'get'
the clock and hold a reference to the clock while they're using it and
all the time that they're needing it to be enabled.
I think I'd like to keep the code as-is to discourage its use in fast
paths. In any case:
> @@ -52,10 +58,10 @@ static struct clk_lookup *clk_find(const char *dev_id, const char *con_id)
>
> if (match > best) {
> cl = p;
> - if (match != 3)
> - best = match;
> - else
> + if (match == point)
> break;
> + else
> + best = match;
Why not just change the '3' to be 'point' here - why restructure the code?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-09-19 11:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-16 14:14 [PATCH] CLKDEV: Reduce scaning time Jonghwan Choi
2011-09-19 11:13 ` Russell King - ARM Linux
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).