gpu: nvgpu: gk20a: export wait_channel_idle()
Deepak Nibade [Tue, 20 May 2014 09:30:30 +0000 (14:30 +0530)]
- Export gk20a_wait_channel_idle() function from channel_gk20a.h
- also, return error -EBUSY from this function when channel is
  found to be not idle

Bug 1487804

Change-Id: Ia7425e9b1332260ee9a53dca55ab07541f2755a9
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/412059
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>

drivers/gpu/nvgpu/gk20a/channel_gk20a.c
drivers/gpu/nvgpu/gk20a/channel_gk20a.h

index cf239b5..68a3039 100644 (file)
@@ -418,7 +418,7 @@ void gk20a_disable_channel_no_update(struct channel_gk20a *ch)
                     ccsr_channel_enable_clr_true_f());
 }
 
-static int gk20a_wait_channel_idle(struct channel_gk20a *ch)
+int gk20a_wait_channel_idle(struct channel_gk20a *ch)
 {
        bool channel_idle = false;
        unsigned long end_jiffies = jiffies +
@@ -435,8 +435,11 @@ static int gk20a_wait_channel_idle(struct channel_gk20a *ch)
        } while (time_before(jiffies, end_jiffies)
                        || !tegra_platform_is_silicon());
 
-       if (!channel_idle)
-               gk20a_err(dev_from_gk20a(ch->g), "channel jobs not freed");
+       if (!channel_idle) {
+               gk20a_err(dev_from_gk20a(ch->g), "jobs not freed for channel %d\n",
+                               ch->hw_chid);
+               return -EBUSY;
+       }
 
        return 0;
 }
index e37511c..dd0197d 100644 (file)
@@ -170,4 +170,6 @@ void gk20a_channel_update(struct channel_gk20a *c, int nr_completed);
 
 void gk20a_init_channel(struct gpu_ops *gops);
 
+int gk20a_wait_channel_idle(struct channel_gk20a *ch);
+
 #endif /*__CHANNEL_GK20A_H__*/