linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: jhbird.choi@gmail.com (Jonghwan Choi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] CLKDEV: Reduce scaning time
Date: Fri, 16 Sep 2011 23:14:12 +0900	[thread overview]
Message-ID: <1316182452-14061-1-git-send-email-jhbird.choi@gmail.com> (raw)

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

             reply	other threads:[~2011-09-16 14:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-16 14:14 Jonghwan Choi [this message]
2011-09-19 11:13 ` [PATCH] CLKDEV: Reduce scaning time Russell King - ARM Linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1316182452-14061-1-git-send-email-jhbird.choi@gmail.com \
    --to=jhbird.choi@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).