[PATCH 2/4] regulator: core: notify regulator enable with the voltage value
From: Jianqun Xu
Date: Sun Aug 15 2021 - 23:20:27 EST
Get the voltage of regulator and then pass it as the parameter of
notify, the driver could take it.
The origin parameter for notify is NULL, so this patch do nothing effect
to other driver who not care about the voltage value.
Signed-off-by: Jianqun Xu <jay.xu@xxxxxxxxxxxxxx>
---
drivers/regulator/core.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index f192bf19492e..a53f1644a6f4 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2658,8 +2658,12 @@ static int _regulator_enable(struct regulator *regulator)
if (ret < 0)
goto err_consumer_disable;
+ ret = _regulator_get_voltage(rdev);
+ if (ret < 0)
+ ret = 0;
+
_notifier_call_chain(rdev, REGULATOR_EVENT_ENABLE,
- NULL);
+ &ret);
} else if (ret < 0) {
rdev_err(rdev, "is_enabled() failed: %pe\n", ERR_PTR(ret));
goto err_consumer_disable;
--
2.25.1