Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Krzysztof Kozlowski and committed by
Alexandre Belloni
3f76ba88 2a388ff2

+7 -15
+7 -15
drivers/rtc/rtc-stm32.c
··· 1074 1074 regs = &rtc->data->regs; 1075 1075 1076 1076 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); 1079 1082 if (IS_ERR(rtc->dbp)) { 1080 1083 dev_err(&pdev->dev, "no st,syscfg\n"); 1081 1084 return PTR_ERR(rtc->dbp); 1082 1085 } 1083 1086 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]; 1097 1089 } 1098 1090 1099 1091 if (!rtc->data->has_pclk) {