media: tegra: nvavp: fix deadlock issue
authorAllen Yu <alleny@nvidia.com>
Wed, 2 Jul 2014 07:14:24 +0000 (15:14 +0800)
committerMandar Padmawar <mpadmawar@nvidia.com>
Fri, 4 Jul 2014 13:13:59 +0000 (06:13 -0700)
commit1be10e6325b730e8d4d6854965f66a147f0c2863
treefe7a7ef6dbca48312856a0710e17ad42d74bb356
parent8e332826d660e52478ce7c3a407d8e004448cc28
media: tegra: nvavp: fix deadlock issue

In nvavp_pushbuffer_update(), we acquire channel_info->pushbuffer_lock first
then nvavp->open_lock. While in clock_disable_handler(), open_lock is acquired
before pushbuffer_lock, causing the deadlock if clock_disable_work happens to
be executing while running nvavp_pushbuffer_update().

This change reorder the locks in clock_disable_handler to avoid deadlock issue.
And also in tegra_nvavp_release(), need to release nvavp->open_lock first before
calling nvavp_uninit(), since nvavp_uninit() need to cancel clock_disable_work
in a synchronous manner.

Bug 200013513

Change-Id: I42082a97cc4e311a4141559f8a56c7c1eeb97eb2
Signed-off-by: Allen Yu <alleny@nvidia.com>
Reviewed-on: http://git-master/r/433523
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Soumenkumar Dey <sdey@nvidia.com>
Reviewed-by: Mandar Potdar <mpotdar@nvidia.com>
Tested-by: Yogesh Solanke <ysolanke@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Somu Sundaram <somasundarams@nvidia.com>
drivers/media/platform/tegra/nvavp/nvavp_dev.c