Message ID | 20250111185358.183725-1-krzysztof.kozlowski@linaro.org |
---|---|
State | New |
Headers | show |
Series | reset: keystone: Use syscon_regmap_lookup_by_phandle_args | expand |
On Sat, 11 Jan 2025 19:53:58 +0100, Krzysztof Kozlowski wrote: > 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. > > [...] Applied, thanks! [1/1] reset: keystone: Use syscon_regmap_lookup_by_phandle_args commit: 81312ea9b892e2c6989cce7274eca9f437ba6cf1 Best regards,
diff --git a/drivers/power/reset/keystone-reset.c b/drivers/power/reset/keystone-reset.c index cfaa54ced0d0..d9268d150e1f 100644 --- a/drivers/power/reset/keystone-reset.c +++ b/drivers/power/reset/keystone-reset.c @@ -87,26 +87,16 @@ static int rsctrl_probe(struct platform_device *pdev) return -ENODEV; /* get regmaps */ - pllctrl_regs = syscon_regmap_lookup_by_phandle(np, "ti,syscon-pll"); + pllctrl_regs = syscon_regmap_lookup_by_phandle_args(np, "ti,syscon-pll", + 1, &rspll_offset); if (IS_ERR(pllctrl_regs)) return PTR_ERR(pllctrl_regs); - devctrl_regs = syscon_regmap_lookup_by_phandle(np, "ti,syscon-dev"); + devctrl_regs = syscon_regmap_lookup_by_phandle_args(np, "ti,syscon-dev", + 1, &rsmux_offset); if (IS_ERR(devctrl_regs)) return PTR_ERR(devctrl_regs); - ret = of_property_read_u32_index(np, "ti,syscon-pll", 1, &rspll_offset); - if (ret) { - dev_err(dev, "couldn't read the reset pll offset!\n"); - return -EINVAL; - } - - ret = of_property_read_u32_index(np, "ti,syscon-dev", 1, &rsmux_offset); - if (ret) { - dev_err(dev, "couldn't read the rsmux offset!\n"); - return -EINVAL; - } - /* set soft/hard reset */ val = of_property_read_bool(np, "ti,soft-reset"); val = val ? RSCFG_RSTYPE_SOFT : RSCFG_RSTYPE_HARD;
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 <krzysztof.kozlowski@linaro.org> --- drivers/power/reset/keystone-reset.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)