video: tegra: host: Remove pre-check in syncpt wait
Terje Bergstrom [Mon, 26 Mar 2012 11:07:41 +0000 (14:07 +0300)]
Remove the check and debug dump for cases where we compare against
an old syncpt value. Also removes an extra check that is already done
by wait_event_interruptible_timeout();

Bug 941327

Change-Id: Icbaf70b04a8bd070c3fdd3467b981de11219d2b9
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/92283
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>

drivers/video/tegra/host/nvhost_syncpt.c

index c41ecd9..eb5176e 100644 (file)
@@ -128,20 +128,11 @@ int nvhost_syncpt_wait_timeout(struct nvhost_syncpt *sp, u32 id,
        void *ref;
        void *waiter;
        int err = 0, check_count = 0, low_timeout = 0;
+       u32 val;
 
        if (value)
                *value = 0;
 
-       BUG_ON(!syncpt_op(sp).update_min);
-       if (!nvhost_syncpt_check_max(sp, id, thresh)) {
-               dev_warn(&syncpt_to_dev(sp)->dev->dev,
-                       "wait %d (%s) for (%d) wouldn't be met (max %d)\n",
-                       id, syncpt_op(sp).name(sp, id), thresh,
-                       nvhost_syncpt_read_max(sp, id));
-               nvhost_debug_dump(syncpt_to_dev(sp));
-               return -EINVAL;
-       }
-
        /* first check cache */
        if (nvhost_syncpt_is_expired(sp, id, thresh)) {
                if (value)
@@ -152,14 +143,12 @@ int nvhost_syncpt_wait_timeout(struct nvhost_syncpt *sp, u32 id,
        /* keep host alive */
        nvhost_module_busy(syncpt_to_dev(sp)->dev);
 
-       if (client_managed(id) || !nvhost_syncpt_min_eq_max(sp, id)) {
-               /* try to read from register */
-               u32 val = syncpt_op(sp).update_min(sp, id);
-               if ((s32)(val - thresh) >= 0) {
-                       if (value)
-                               *value = val;
-                       goto done;
-               }
+       /* try to read from register */
+       val = syncpt_op(sp).update_min(sp, id);
+       if (nvhost_syncpt_is_expired(sp, id, thresh)) {
+               if (value)
+                       *value = val;
+               goto done;
        }
 
        if (!timeout) {
@@ -192,7 +181,7 @@ int nvhost_syncpt_wait_timeout(struct nvhost_syncpt *sp, u32 id,
                int remain = wait_event_interruptible_timeout(wq,
                                nvhost_syncpt_is_expired(sp, id, thresh),
                                check);
-               if (remain > 0 || nvhost_syncpt_is_expired(sp, id, thresh)) {
+               if (remain > 0) {
                        if (value)
                                *value = nvhost_syncpt_read_min(sp, id);
                        err = 0;