Message ID | 20210816032003.1162779-3-jay.xu@rock-chips.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | regulator pre-enable | expand |
On Mon, Aug 16, 2021 at 11:20:01AM +0800, Jianqun Xu wrote: > + ret = _regulator_get_voltage(rdev); > + if (ret < 0) > + ret = 0; > + > _notifier_call_chain(rdev, REGULATOR_EVENT_ENABLE, > - NULL); > + &ret); This is going to be really expensive for devices without a cache and it's going to be *very* rarely used if ever.
Hi, Mark -------------- jay.xu@rock-chips.com >On Mon, Aug 16, 2021 at 11:20:01AM +0800, Jianqun Xu wrote: > >> + ret = _regulator_get_voltage(rdev); >> + if (ret < 0) >> + ret = 0; >> + >> _notifier_call_chain(rdev, REGULATOR_EVENT_ENABLE, >> - NULL); >> + &ret); > >This is going to be really expensive for devices without a cache and >it's going to be *very* rarely used if ever. How about to only to notify the EVENT_ENABLE without get voltage, then driver who care about this event could get the voltage itself ?
-------------- jay.xu@rock-chips.com >Hi, Mark >-------------- >jay.xu@rock-chips.com >>On Mon, Aug 16, 2021 at 11:20:01AM +0800, Jianqun Xu wrote: >> >>> + ret = _regulator_get_voltage(rdev); >>> + if (ret < 0) >>> + ret = 0; >>> + >>> _notifier_call_chain(rdev, REGULATOR_EVENT_ENABLE, >>> - NULL); >>> + &ret); >> >>This is going to be really expensive for devices without a cache and >>it's going to be *very* rarely used if ever. > >How about to only to notify the EVENT_ENABLE without get voltage, then driver who care about this event >could get the voltage itself ? ignore my reply here about EVENT_ENABLE, sorry How about the next patch about PRE_ENABLE ? At least I need a notify without voltage
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;
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@rock-chips.com> --- drivers/regulator/core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)