Skip to content

Commit 81312ea

Browse files
krzksre
authored andcommitted
power: reset: keystone: Use syscon_regmap_lookup_by_phandle_args
Use syscon_regmap_lookup_by_phandle_args() which is a wrapper over syscon_regmap_lookup_by_phandle() combined with getting the syscon argument. Except simpler code this annotates within one line that given phandle has arguments, so grepping for code would be easier. There is also no real benefit in printing errors on missing syscon argument, because this is done just too late: runtime check on static/build-time data. Dtschema and Devicetree bindings offer the static/build-time check for this already. Signed-off-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 2d678e3 commit 81312ea

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

drivers/power/reset/keystone-reset.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,26 +87,16 @@ static int rsctrl_probe(struct platform_device *pdev)
8787
return -ENODEV;
8888

8989
/* get regmaps */
90-
pllctrl_regs = syscon_regmap_lookup_by_phandle(np, "ti,syscon-pll");
90+
pllctrl_regs = syscon_regmap_lookup_by_phandle_args(np, "ti,syscon-pll",
91+
1, &rspll_offset);
9192
if (IS_ERR(pllctrl_regs))
9293
return PTR_ERR(pllctrl_regs);
9394

94-
devctrl_regs = syscon_regmap_lookup_by_phandle(np, "ti,syscon-dev");
95+
devctrl_regs = syscon_regmap_lookup_by_phandle_args(np, "ti,syscon-dev",
96+
1, &rsmux_offset);
9597
if (IS_ERR(devctrl_regs))
9698
return PTR_ERR(devctrl_regs);
9799

98-
ret = of_property_read_u32_index(np, "ti,syscon-pll", 1, &rspll_offset);
99-
if (ret) {
100-
dev_err(dev, "couldn't read the reset pll offset!\n");
101-
return -EINVAL;
102-
}
103-
104-
ret = of_property_read_u32_index(np, "ti,syscon-dev", 1, &rsmux_offset);
105-
if (ret) {
106-
dev_err(dev, "couldn't read the rsmux offset!\n");
107-
return -EINVAL;
108-
}
109-
110100
/* set soft/hard reset */
111101
val = of_property_read_bool(np, "ti,soft-reset");
112102
val = val ? RSCFG_RSTYPE_SOFT : RSCFG_RSTYPE_HARD;

0 commit comments

Comments
 (0)