msm: rpc: While powering down flush all the rpcrouter workqueues

When the device is powered down, RPC Router closes all the transports
and releases all the associated data structures. This sometimes lead to
works queued in the RPC router workqueues to access stale data and hence
cause kernel panic. So when the device is powered down, abort the works
queued in the workqueues and wait until the workqueues are flushed and
then free the associated data structures.

CRs-Fixed: 312078
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
(cherry picked from commit c74ab97)

Change-Id: Ia342637156df0cc3f934bc7778c2ef94dda735c3
Signed-off-by: Shruthi Krishna <skrish@codeaurora.org>

msm: rpc: Reorganize the usage of spinlocks in RPC Router reader thread
A race condition exists between a driver closing an RPC endpoint and
RPC Router routing an incoming RPC message to that endpoint. So hold
the appropriate locks to avoid both the events happening simultaneously.

CRs-Fixed: 301630

Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
(cherry picked from commit 6dc3181)

Change-Id: I2d8b1f45b6ac6804a1e06d2d9e0da47f2ec81c64
Signed-off-by: Raj Kushwaha <rajk@codeaurora.org>
Signed-off-by: garwedgess <garethwilliams21@gmail.com>