[PATCH 08/11] regulator: register regulator as last step in of_regulator_register()
Marco Felsch
m.felsch at pengutronix.de
Wed Sep 20 04:39:22 PDT 2023
On 23-09-20, Sascha Hauer wrote:
> In of_regulator_register() call __regulator_register as last step after
> all fields have been initialized. This was not possible before as
> __regulator_register() returned the struct regulator_internal * which
> contained the remaining fields. Now that struct regulator_internal is
> gone we can restore the natural initialization order.
>
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> ---
> drivers/regulator/core.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index b9a97a784f..d08df1dc68 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -240,10 +240,6 @@ int of_regulator_register(struct regulator_dev *rdev, struct device_node *node)
> if (!name)
> name = node->name;
>
> - ret = __regulator_register(rdev, name);
> - if (ret)
> - return ret;
> -
> rdev->node = node;
> node->dev = rdev->dev;
>
> @@ -260,6 +256,10 @@ int of_regulator_register(struct regulator_dev *rdev, struct device_node *node)
> of_property_read_u32(node, "regulator-max-microvolt",
> &rdev->max_uv);
>
> + ret = __regulator_register(rdev, name);
return __regulator_register(rdev, name);
Regards,
Marco
> + if (ret)
> + return ret;
> +
> return 0;
> }
>
> --
> 2.39.2
>
>
>
More information about the barebox
mailing list