[PATCH 08/11] regulator: register regulator as last step in of_regulator_register()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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);
+	if (ret)
+		return ret;
+
 	return 0;
 }
 
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux