Skip to content

Commit 3f76ba8

Browse files
krzkalexandrebelloni
authored andcommitted
rtc: stm32: 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 <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20250111185405.183824-1-krzysztof.kozlowski@linaro.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent 2a388ff commit 3f76ba8

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

drivers/rtc/rtc-stm32.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,26 +1074,18 @@ static int stm32_rtc_probe(struct platform_device *pdev)
10741074
regs = &rtc->data->regs;
10751075

10761076
if (rtc->data->need_dbp) {
1077-
rtc->dbp = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
1078-
"st,syscfg");
1077+
unsigned int args[2];
1078+
1079+
rtc->dbp = syscon_regmap_lookup_by_phandle_args(pdev->dev.of_node,
1080+
"st,syscfg",
1081+
2, args);
10791082
if (IS_ERR(rtc->dbp)) {
10801083
dev_err(&pdev->dev, "no st,syscfg\n");
10811084
return PTR_ERR(rtc->dbp);
10821085
}
10831086

1084-
ret = of_property_read_u32_index(pdev->dev.of_node, "st,syscfg",
1085-
1, &rtc->dbp_reg);
1086-
if (ret) {
1087-
dev_err(&pdev->dev, "can't read DBP register offset\n");
1088-
return ret;
1089-
}
1090-
1091-
ret = of_property_read_u32_index(pdev->dev.of_node, "st,syscfg",
1092-
2, &rtc->dbp_mask);
1093-
if (ret) {
1094-
dev_err(&pdev->dev, "can't read DBP register mask\n");
1095-
return ret;
1096-
}
1087+
rtc->dbp_reg = args[0];
1088+
rtc->dbp_mask = args[1];
10971089
}
10981090

10991091
if (!rtc->data->has_pclk) {

0 commit comments

Comments
 (0)