rtc: stm32: Use syscon_regmap_lookup_by_phandle_args
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Sat, 11 Jan 2025 18:54:05 +0000 (19:54 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 13 Jan 2025 08:33:39 +0000 (09:33 +0100)
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>
drivers/rtc/rtc-stm32.c

index 9f1a019ec8afa57245c6d40d378ec50fdcd64deb..a0564d4435690313b86669893ec639af90fd6b68 100644 (file)
@@ -1074,26 +1074,18 @@ static int stm32_rtc_probe(struct platform_device *pdev)
        regs = &rtc->data->regs;
 
        if (rtc->data->need_dbp) {
-               rtc->dbp = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
-                                                          "st,syscfg");
+               unsigned int args[2];
+
+               rtc->dbp = syscon_regmap_lookup_by_phandle_args(pdev->dev.of_node,
+                                                               "st,syscfg",
+                                                               2, args);
                if (IS_ERR(rtc->dbp)) {
                        dev_err(&pdev->dev, "no st,syscfg\n");
                        return PTR_ERR(rtc->dbp);
                }
 
-               ret = of_property_read_u32_index(pdev->dev.of_node, "st,syscfg",
-                                                1, &rtc->dbp_reg);
-               if (ret) {
-                       dev_err(&pdev->dev, "can't read DBP register offset\n");
-                       return ret;
-               }
-
-               ret = of_property_read_u32_index(pdev->dev.of_node, "st,syscfg",
-                                                2, &rtc->dbp_mask);
-               if (ret) {
-                       dev_err(&pdev->dev, "can't read DBP register mask\n");
-                       return ret;
-               }
+               rtc->dbp_reg = args[0];
+               rtc->dbp_mask = args[1];
        }
 
        if (!rtc->data->has_pclk) {