• S
    regulator: core: introduce function to lock regulators and its supplies · 9f01cd4a
    Sascha Hauer 提交于
    Each regulator_dev is locked with its own mutex. This is fine as long
    as only one regulator_dev is locked, but makes lockdep unhappy when we
    have to walk up the supply chain like it can happen in
    regulator_get_voltage:
    
    regulator_get_voltage ->
     mutex_lock(&regulator->rdev->mutex) ->
    _regulator_get_voltage(regulator->rdev) ->
    regulator_get_voltage(rdev->supply) ->
    mutex_lock(&regulator->rdev->mutex);
    
    This causes lockdep to issue a possible deadlock warning.
    
    There are at least two ways to work around this:
    
    - We can always lock the whole supply chain using the functions
      introduced with this patch.
    - We could store the current voltage in struct regulator_rdev so
      that we do not have to walk up the supply chain for the
      _regulator_get_voltage case.
    
    Anyway, regulator_lock_supply/regulator_unlock_supply will be needed
    once we allow regulator_set_voltage to optimize the supply voltages.
    Signed-off-by: NSascha Hauer <s.hauer@pengutronix.de>
    Signed-off-by: NMark Brown <broonie@kernel.org>
    9f01cd4a
core.c 109.8 KB