regulator: core: avoid unneeded .list_voltage calls
authorCristian Marussi <cristian.marussi@arm.com>
Mon, 9 Dec 2019 12:52:39 +0000 (12:52 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 9 Dec 2019 18:41:40 +0000 (18:41 +0000)
commit6d30fc511bec82dd8801b9bb8718cbeea1366ad8
tree3d481181a1d02fcfbb950bb2797679eac7a5cc98
parentf3c7f7b636ef5061906aa119eccc2b8dbbaf7199
regulator: core: avoid unneeded .list_voltage calls

Inside machine_constraints_voltage() a loop is in charge of verifying that
each of the defined voltages are within the configured constraints and
that those constraints are in fact compatible with the available voltages'
list.

When the registered regulator happens to be defined with a wide range of
possible voltages the above O(n) loop can be costly.
Moreover since this behaviour is triggered during the registration process,
it means also that it can be easily triggered at probe time, slowing down
considerably some module loading.

On the other side if such wide range of voltage values happens to be also
continuous and without discontinuity of any kind, the above potentially
cumbersome operation is also useless.

For these reasons, avoid such .list_voltage poll loop when regulator is
described as 'continuous_voltage_range' as is, indeed, similarly already
done inside regulator_is_supported_voltage().

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Link: https://lore.kernel.org/r/20191209125239.46054-1-cristian.marussi@arm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/core.c