• Maciej Purski's avatar
    regulator: core: Make locks re-entrant · 66cf9a7e
    Maciej Purski authored
    Setting voltage, enabling/disabling regulators requires operations on
    all regulators related with the regulator being changed. Therefore,
    all of them should be locked for the whole operation. With the current
    locking implementation, adding additional dependency (regulators
    coupling) causes deadlocks in some cases.
    
    Introduce a possibility to attempt to lock a mutex multiple times
    by the same task without waiting on a mutex. This should handle all
    reasonable coupling-supplying combinations, especially when two coupled
    regulators share common supplies. The only situation that should be
    forbidden is simultaneous coupling and supplying between a pair of
    regulators.
    
    The idea is based on clk core.
    Signed-off-by: default avatarMaciej Purski <m.purski@samsung.com>
    Signed-off-by: default avatarMark Brown <broonie@kernel.org>
    66cf9a7e
core.c 122 KB