]> Gentwo Git Trees - linux/.git/commitdiff
regulator: bd71815: Constify pointers to 'regulator_desc' wrap struct
authorKrzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Wed, 26 Nov 2025 16:58:45 +0000 (17:58 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 26 Nov 2025 18:44:27 +0000 (18:44 +0000)
Pointer to 'struct regulator_desc' is a pointer to const and the
wrapping structure (container) is not being modified, thus entire syntax
can be replaced to preferred and safer container_of_const().

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://patch.msgid.link/20251126-container-of-const-regulator-v1-2-eeec378144d4@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/bd71815-regulator.c

index 79fbb45297f6bc0ddd0df9a1e4c901a48098cec7..8da57a7bb2f1bf70d3337c9465ab1ef7a2ae1fa8 100644 (file)
@@ -173,9 +173,9 @@ static int set_hw_dvs_levels(struct device_node *np,
                             const struct regulator_desc *desc,
                             struct regulator_config *cfg)
 {
-       struct bd71815_regulator *data;
+       const struct bd71815_regulator *data;
 
-       data = container_of(desc, struct bd71815_regulator, desc);
+       data = container_of_const(desc, struct bd71815_regulator, desc);
        return rohm_regulator_set_dvs_levels(data->dvs, np, desc, cfg->regmap);
 }
 
@@ -195,10 +195,10 @@ static int buck12_set_hw_dvs_levels(struct device_node *np,
                                    const struct regulator_desc *desc,
                                    struct regulator_config *cfg)
 {
-       struct bd71815_regulator *data;
+       const struct bd71815_regulator *data;
        int ret = 0, val;
 
-       data = container_of(desc, struct bd71815_regulator, desc);
+       data = container_of_const(desc, struct bd71815_regulator, desc);
 
        if (of_property_present(np, "rohm,dvs-run-voltage") ||
            of_property_present(np, "rohm,dvs-suspend-voltage") ||