Skip to contentSkip to conversation

clk: Do a DT parent lookup even when index < 0

PATCH Applied Stephen Boyd 2 participants 3 messages Jun 14, 2019 – Jun 17, 2019 Common clk

lore
Share & tools
lore

Stephen Boyd

author maintainer
#0 lore raw

PATCH 1/1 clk: Do a DT parent lookup even when index < 0

We want to allow the parent lookup to happen even if the index is some value less than 0. This may be the case if a clk provider only specifies the .name member to match a string in the "clock-names" DT property. We shouldn't require that the index be >= 0 to make this use case work.

Fixes 601b6e93304a ("clk: Allow parents to be specified via clkspec index")
Cc Jerome Brunet <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
---
 drivers/clk/clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk.c +1 -1
index aa51756fd4d6..87b410d6e51d 100644
@@ -368,7 +368,7 @@ static struct clk_core *clk_core_get(struct clk_core *core, u8 p_index)
 	const char *dev_id = dev ? dev_name(dev) : NULL;
 	struct device_node *np = core->of_node;
 
-	if (np && index >= 0)
+	if (np && (name || index >= 0))
 		hw = of_clk_get_hw(np, index, name);
 
 	/*
Signature · 1 line
Sent by a computer through tubes
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Stephen Boyd

We want to allow the parent lookup to happen even if the index is some value less than 0. This may be the case if a clk provider only specifies the .name member to match a string in the "clock-names" DT property. We shouldn't require that the index be >= 0 to make this use case work.

Fixes 601b6e93304a ("clk: Allow parents to be specified via clkspec index")
Cc Jerome Brunet <[email protected]>
Cc Chen-Yu Tsai <[email protected]>

FWIW,

author maintainer Applied
#2 lore raw
In reply to Stephen Boyd

Quoting Stephen Boyd (2019-06-14 11:10:40)

Quoted 11 lines

We want to allow the parent lookup to happen even if the index is some value less than 0. This may be the case if a clk provider only specifies the .name member to match a string in the "clock-names" DT property. We shouldn't require that the index be >= 0 to make this use case work.

Fixes 601b6e93304a ("clk: Allow parents to be specified via clkspec index")
Cc Jerome Brunet <[email protected]>
Cc Chen-Yu Tsai <[email protected]>

---

Applied to clk-fixes