]> git.karo-electronics.de Git - linux-beck.git/commit
regulator: reorder initialization steps in regulator_register()
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Tue, 12 Apr 2016 10:31:00 +0000 (12:31 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 13 Apr 2016 06:33:44 +0000 (07:33 +0100)
commit469b640e4f4a28bdd50f0ac1d2b310907afb464c
treec739534dfe6b5bc6441680c51d21ed4269fdd8ce
parentf55532a0c0b8bb6148f4e07853b876ef73bc69ca
regulator: reorder initialization steps in regulator_register()

device_register() is calling ->get_voltage() as part of it's sysfs attribute
initialization process, and this functions might need to know the regulator
constraints to return a valid value.
This is at least true for the pwm regulator driver (when operating in
continuous mode) which needs to know the minimum and maximum voltage values
to calculate the current voltage:

min_uV + (((max_uV - min_uV) * dutycycle) / 100);

Move device_register() after set_machine_constraints() to make sure those
constraints are correctly initialized when ->get_voltage() is called.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reported-by: Stephen Barber <smbarber@chromium.org>
Tested-by: Caesar Wang <wxt@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/core.c