msm: subsystem_restart: Make subsystem_restart interrupt context safe

To allow for correct behavior during sleep modes, it is
necessary that clients call subsystem restart within the
interrupt handler assigned to the error interrupt for their
subsystems. This implies that the subsystem_restart() API
needs to be able to safely run in an interrupt context.

Use a workqueue instead of a kthread to perform subsystem
restart, since kthreads cannot be created in an atomic
context. Note that concurrency managed workqueues (cmwq) allow
the behavior of the subsystem restart API to be preserved
even after replacing the kthread with a workqueue. This
is because with cmwq, a work item that sleeps during its
execution will not prevent the next-scheduled-work item
from executing. Thus multiple restart sequences can execute
at the same time, as was the case with kthreads.

Change-Id: I6adaaed0e2312de1d508f289328dc2d5e64679a5
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
1 file changed