Skip to contentSkip to conversation

CLKDEV: return from clk_find as soon as we get maching clk

PATCH Superseded Viresh KUMAR 2 participants 4 messages Mar 3, 2010 – Mar 4, 2010 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 CLKDEV: return from clk_find as soon as we get maching clk

clk_find function looks for clock with matching dev_id and con_id. We should return from clk_find as soon as we get a clock with matching dev_id and con_id. This can be done by comparing variable "match" with 3.

v2:
- remove if (match == 0), check.
- move match==3 in if (match > best) condition

---
 arch/arm/common/clkdev.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
arch/arm/common/clkdev.c +4 -3
index aae5bc0..efd53f7 100644
@@ -52,12 +52,13 @@ static struct clk *clk_find(const char *dev_id, const char *con_id)
 				continue;
 			match += 1;
 		}
-		if (match == 0)
-			continue;
 
 		if (match > best) {
 			clk = p->clk;
-			best = match;
+			if (match != 3)
+				best = match;
+			else
+				break;
 		}
 	}
 	return clk;
Signature · 1 line
1.6.0.2
#1 lore raw

PATCH v2 1/1 CLKDEV: return from clk_find as soon as we get maching clk

Hello,

Quoted 7 lines · Viresh KUMAR

clk_find function looks for clock with matching dev_id and con_id. We should return from clk_find as soon as we get a clock with matching dev_id and con_id. This can be done by comparing variable "match" with 3.

v2:
- remove if (match == 0), check.
- move match==3 in if (match > best) condition

can you take the changes since v1 out of the changelog. They usually go
...

Quoted 3 lines

---

... here.

Does this mean you understood Russell's hint?

Did you test the differences your patch results in for the generated code?

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#2 lore raw

PATCH v2 1/1 CLKDEV: return from clk_find as soon as we get maching clk

Hello,

Quoted 10 lines · Uwe Kleine-K?nig
Quoted 7 lines · Viresh KUMAR

clk_find function looks for clock with matching dev_id and con_id. We should return from clk_find as soon as we get a clock with matching dev_id and con_id. This can be done by comparing variable "match" with 3.

v2:
- remove if (match == 0), check.
- move match==3 in if (match > best) condition

can you take the changes since v1 out of the changelog. They usually go
...

OK.

Quoted 4 lines
Quoted 3 lines

---

Does this mean you understood Russell's hint?

Truly speaking i didn't get it completely, but i think Russsell is referring to multiple return points from a function.

Russell, Am I getting it correctly ?

Quoted 2 lines

Did you test the differences your patch results in for the generated code?

I think they are essentially same, we now just have a single return point in the new patch.

regards,
viresh

#3 lore raw

PATCH v2 1/1 CLKDEV: return from clk_find as soon as we get maching clk

Hello,

Quoted 5 lines
Quoted 1 line

Does this mean you understood Russell's hint?

Truly speaking i didn't get it completely, but i think Russsell is referring to multiple return points from a function.

Quoted 7 lines

Russell, Am I getting it correctly ?

Quoted 2 lines

Did you test the differences your patch results in for the generated code?

I think they are essentially same, we now just have a single return point in the new patch.

Well then,

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |