msm: SSR: Track state of restart orders atomically
The subsystem restart workqueue function uses trylocks to
determine if subsystem restarts are already in progress. This
requires two locks for powerup and shutdown and complicates the
code.
In the future when we add subsystem_get() and subsystem_put() we
will need to block the workqueue from calling the device ops that
boot and shutdown a processor concurrently with subsystem_get()
or subsystem_put(). Using trylocks for this may not even work.
Let's simplify things by using one mutex for the workqueue and
add a private state tracking enum so we know how far we've gotten
through the workqueue function. Wrap all this up into 'struct
subsys_tracking' that the restart order and the subsystem device
both have. If the device is part of a restart order we'll use the
tracking struct from the restart order, otherwise we'll use the
one in the subsystem. Then perform the same checks we've done
before to panic in cases where the subsystem crashes after it's
been shutdown. The difference is that now we're tracking the
state of the entire restart order atomically, reacting
appropriately in __subsystem_restart_dev() and avoiding any
complications due to trylocks.
Also throw in some documentation for the structs and enums while
we're here.
Change-Id: I51afd839fc8e2cb5a95df929771f41a37741a137
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
1 file changed