ARM: shmobile: rcar-gen2: Fix deadlock in regulator quirk
authorGeert Uytterhoeven <geert+renesas@glider.be>
Wed, 12 Jul 2017 14:45:20 +0000 (16:45 +0200)
committerSimon Horman <horms+renesas@verge.net.au>
Sat, 29 Jul 2017 08:32:52 +0000 (10:32 +0200)
commitfce8dc5e50e44d8f644e0f7854e6d7d518fedb68
tree92bc3affede983b7ba38cbef8371fc8e6a9e78c5
parent2ea659a9ef488125eb46da6eb571de5eae5c43f6
ARM: shmobile: rcar-gen2: Fix deadlock in regulator quirk

Simon Horman reported that Koelsch and Lager hang during boot, and
bisected this to commit 1c3c5eab171590f8 ("sched/core: Enable
might_sleep() and smp_processor_id() checks early").

The da9063/da9210 regulator quirk for R-Car Gen2 boards uses a bus
notifier, and unregisters the notifier when it is no longer needed.
However, a notifier must not be unregistered from within the call chain.

This bug went unnoticed, as blocking_notifier_chain_unregister() didn't
take the semaphore during early boot.  The aforementioned commit changed
that behavior, leading to a deadlock.

Fix this by removing the call to bus_unregister_notifier(), and keeping
local completion state instead.

Reported-by: Simon Horman <horms+renesas@verge.net.au>
Fixes: 663fbb52159cca6f ("ARM: shmobile: R-Car Gen2: Add da9063/da9210 regulator quirk")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c