diff mbox series

[v1] regulator: defer probe when trying to get voltage from unresolved supply

Message ID a9041d68b4d35e4a2dd71629c8a6422662acb5ee.1604351936.git.mirq-linux@rere.qmqm.pl (mailing list archive)
State New, archived
Headers show
Series [v1] regulator: defer probe when trying to get voltage from unresolved supply | expand

Commit Message

Michał Mirosław Nov. 2, 2020, 9:27 p.m. UTC
regulator_get_voltage_rdev() is called in regulator probe() when
applying machine constraints.  The "fixed" commit exposed the problem
that non-bypassed regulators can forward the request to its parent
(like bypassed ones) supply. Return -EPROBE_DEFER when the supply
is expected but not resolved yet.

Fixes: aea6cb99703e ("regulator: resolve supply after creating regulator")
Cc: stable@vger.kernel.org
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Reported-by: Ondřej Jirman <megous@megous.com>
Reported-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 v1: this is a bit different solution than the hack sent earlier. It should
     be equivalent (putting the error code at the source), but please
     test again.
---
 drivers/regulator/core.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Ondřej Jirman Nov. 3, 2020, 12:59 a.m. UTC | #1
Hello Michal,

On Mon, Nov 02, 2020 at 10:27:27PM +0100, Michał Mirosław wrote:
> regulator_get_voltage_rdev() is called in regulator probe() when
> applying machine constraints.  The "fixed" commit exposed the problem
> that non-bypassed regulators can forward the request to its parent
> (like bypassed ones) supply. Return -EPROBE_DEFER when the supply
> is expected but not resolved yet.
> 

Tested-by: Ondřej Jirman <megous@megous.com>

thank you very much,
	Ondrej

> Fixes: aea6cb99703e ("regulator: resolve supply after creating regulator")
> Cc: stable@vger.kernel.org
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> Reported-by: Ondřej Jirman <megous@megous.com>
> Reported-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> ---
>  v1: this is a bit different solution than the hack sent earlier. It should
>      be equivalent (putting the error code at the source), but please
>      test again.
> ---
>  drivers/regulator/core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index a4ffd71696da..a5ad553da8cd 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -4165,6 +4165,8 @@ int regulator_get_voltage_rdev(struct regulator_dev *rdev)
>  		ret = rdev->desc->fixed_uV;
>  	} else if (rdev->supply) {
>  		ret = regulator_get_voltage_rdev(rdev->supply->rdev);
> +	} else if (rdev->supply_name) {
> +		return -EPROBE_DEFER;
>  	} else {
>  		return -EINVAL;
>  	}
> -- 
> 2.20.1
>
Mark Brown Nov. 3, 2020, 6:15 p.m. UTC | #2
On Mon, 02 Nov 2020 22:27:27 +0100, Michał Mirosław wrote:
> regulator_get_voltage_rdev() is called in regulator probe() when
> applying machine constraints.  The "fixed" commit exposed the problem
> that non-bypassed regulators can forward the request to its parent
> (like bypassed ones) supply. Return -EPROBE_DEFER when the supply
> is expected but not resolved yet.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: defer probe when trying to get voltage from unresolved supply
      commit: cf1ad559a20d1930aa7b47a52f54e1f8718de301

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index a4ffd71696da..a5ad553da8cd 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4165,6 +4165,8 @@  int regulator_get_voltage_rdev(struct regulator_dev *rdev)
 		ret = rdev->desc->fixed_uV;
 	} else if (rdev->supply) {
 		ret = regulator_get_voltage_rdev(rdev->supply->rdev);
+	} else if (rdev->supply_name) {
+		return -EPROBE_DEFER;
 	} else {
 		return -EINVAL;
 	}