diff options
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 44786e4b..16acc1c9 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c | |||
@@ -1776,12 +1776,19 @@ void gk20a_driver_start_unload(struct gk20a *g) | |||
1776 | int gk20a_wait_for_idle(struct device *dev) | 1776 | int gk20a_wait_for_idle(struct device *dev) |
1777 | { | 1777 | { |
1778 | struct gk20a *g = get_gk20a(dev); | 1778 | struct gk20a *g = get_gk20a(dev); |
1779 | struct gk20a_platform *platform; | ||
1779 | int wait_length = 150; /* 3 second overall max wait. */ | 1780 | int wait_length = 150; /* 3 second overall max wait. */ |
1781 | int target_usage_count = 0; | ||
1780 | 1782 | ||
1781 | if (!g) | 1783 | if (!g) |
1782 | return -ENODEV; | 1784 | return -ENODEV; |
1783 | 1785 | ||
1784 | while (atomic_read(&g->usage_count) && wait_length-- >= 0) | 1786 | platform = dev_get_drvdata(dev); |
1787 | if (platform->user_railgate_disabled) | ||
1788 | target_usage_count = 1; | ||
1789 | |||
1790 | while ((atomic_read(&g->usage_count) != target_usage_count) | ||
1791 | && (wait_length-- >= 0)) | ||
1785 | msleep(20); | 1792 | msleep(20); |
1786 | 1793 | ||
1787 | if (wait_length < 0) { | 1794 | if (wait_length < 0) { |