diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2012-05-15 10:42:18 +0300 |
---|---|---|
committer | Rohan Somvanshi <rsomvanshi@nvidia.com> | 2012-05-17 06:41:20 -0700 |
commit | 0db4788c4cc1bc77c66c34a3cee158baf7f6e507 (patch) | |
tree | a58269523fb233a5aa31d8e665835d4e98156fe5 | |
parent | 104787a9aa88aa6a9ae8eca2ffac34acf59cf0f7 (diff) |
video: tegra: host: Yield in case of race of waits
If two threads need to wait for CDMA to become quiet at the same
time, the second one will cause a BUG(). Replace the BUG() with a
code to yield and try again.
Change-Id: I7925ad0cc0e8292919e54d0fa45f7837f453358d
Reviewed-on: http://git-master/r/102437
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Mayuresh Kulkarni <mkulkarni@nvidia.com>
GVS: Gerrit_Virtual_Submit
-rw-r--r-- | drivers/video/tegra/host/nvhost_cdma.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/video/tegra/host/nvhost_cdma.c b/drivers/video/tegra/host/nvhost_cdma.c index 4fcd6f3d3c03..a72e18f16ac7 100644 --- a/drivers/video/tegra/host/nvhost_cdma.c +++ b/drivers/video/tegra/host/nvhost_cdma.c @@ -96,7 +96,13 @@ unsigned int nvhost_cdma_wait_locked(struct nvhost_cdma *cdma, trace_nvhost_wait_cdma(cdma_to_channel(cdma)->dev->name, event); - BUG_ON(cdma->event != CDMA_EVENT_NONE); + /* If somebody has managed to already start waiting, yield */ + if (cdma->event != CDMA_EVENT_NONE) { + mutex_unlock(&cdma->lock); + schedule(); + mutex_lock(&cdma->lock); + continue; + } cdma->event = event; mutex_unlock(&cdma->lock); |