hid: atvr: Fix deadlock race condition in timer
The timer callback could call snd_pcm_period_elapsed()
which need snd_pcm_stream_lock_irqsave() on the substream,
while a snd_pcm_suspend() who already holds the same lock
eventually comes to snd_atvr_timer_stop() and wait the timer
to finish in del_timer_sync(), forming a deadlock.
We could temporarily give up the lock before del_timer_sync()
and relock afterwards. However, that might break the original
purpose of the lock. Thus we just do try_do_del_timer() instead,
which do not block.
As for timer consistency, we ensure previous timer is finished
in snd_atvr_timer_start() instead where the lock concerned is
not held.
Bug
1599000
Change-Id: I04f60a58b263791a97ab33f49a2f24aa03af5d5c
Signed-off-by: Xia Yang <xiay@nvidia.com>
Reviewed-on: http://git-master/r/674612
(cherry picked from commit
7bbe3c502d815e7022a1166aa1177a913c56b887)
Reviewed-on: http://git-master/r/680246
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>