During a subsystem restart or a line-discipline unload with active data transfer, the logical channel purge function (smux_lch_purge) could lead to a deadlock while flushing the workqueues if it is called with mutex_lha0 locked and one of the worker functions calls a function that locks mutex_lha0. In addition, the local mode was reset which is not expected behavior. This change aborts all work functions in the case of a reset allowing the flush to be performed without any locks held. Once the flush is complete, then the appropriate locks can be obtained before the reset flag is cleared and work items can once again get scheduled. Change-Id: I2afbcc3885907cd0cc8695f7c7a85b61a999e1fb Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>