gpu: nvgpu: Pass struct gk20a to busy and resume

Pass struct gk20a pointer to gk20a_busy_noresume() and
gk20a_idle_nosuspend(). This reduces the number of dependencies to
Linux specific struct device.

JIRA NVGPU-38

Change-Id: I5e05be32e2376bc8be5402bb973c20e28c35a1c3
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1505177
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Terje Bergstrom
2017-06-19 14:13:14 -07:00
committed by mobile promotions
parent 2525dc3796
commit 9f65627d0e
3 changed files with 18 additions and 18 deletions

View File

@@ -51,9 +51,9 @@
#define CREATE_TRACE_POINTS #define CREATE_TRACE_POINTS
#include <trace/events/gk20a.h> #include <trace/events/gk20a.h>
void gk20a_busy_noresume(struct device *dev) void gk20a_busy_noresume(struct gk20a *g)
{ {
pm_runtime_get_noresume(dev); pm_runtime_get_noresume(dev_from_gk20a(g));
} }
int gk20a_busy(struct gk20a *g) int gk20a_busy(struct gk20a *g)
@@ -103,9 +103,9 @@ fail:
return ret < 0 ? ret : 0; return ret < 0 ? ret : 0;
} }
void gk20a_idle_nosuspend(struct device *dev) void gk20a_idle_nosuspend(struct gk20a *g)
{ {
pm_runtime_put_noidle(dev); pm_runtime_put_noidle(dev_from_gk20a(g));
} }
void gk20a_idle(struct gk20a *g) void gk20a_idle(struct gk20a *g)
@@ -760,7 +760,7 @@ static int gk20a_pm_suspend(struct device *dev)
int ret = 0; int ret = 0;
if (g->user_railgate_disabled) if (g->user_railgate_disabled)
gk20a_idle_nosuspend(dev); gk20a_idle_nosuspend(g);
if (atomic_read(&dev->power.usage_count) > 1) { if (atomic_read(&dev->power.usage_count) > 1) {
ret = -EBUSY; ret = -EBUSY;
@@ -783,7 +783,7 @@ static int gk20a_pm_suspend(struct device *dev)
fail: fail:
if (g->user_railgate_disabled) if (g->user_railgate_disabled)
gk20a_busy_noresume(dev); gk20a_busy_noresume(g);
return ret; return ret;
} }
@@ -794,7 +794,7 @@ static int gk20a_pm_resume(struct device *dev)
int ret = 0; int ret = 0;
if (g->user_railgate_disabled) if (g->user_railgate_disabled)
gk20a_busy_noresume(dev); gk20a_busy_noresume(g);
if (!g->suspended) if (!g->suspended)
return 0; return 0;

View File

@@ -1475,8 +1475,8 @@ void gk20a_remove_sysfs(struct device *dev);
#define GK20A_BAR1_IORESOURCE_MEM 1 #define GK20A_BAR1_IORESOURCE_MEM 1
#define GK20A_SIM_IORESOURCE_MEM 2 #define GK20A_SIM_IORESOURCE_MEM 2
void gk20a_busy_noresume(struct device *dev); void gk20a_busy_noresume(struct gk20a *g);
void gk20a_idle_nosuspend(struct device *dev); void gk20a_idle_nosuspend(struct gk20a *g);
int __must_check gk20a_busy(struct gk20a *g); int __must_check gk20a_busy(struct gk20a *g);
void gk20a_idle(struct gk20a *g); void gk20a_idle(struct gk20a *g);
int __gk20a_do_idle(struct gk20a *g, bool force_reset); int __gk20a_do_idle(struct gk20a *g, bool force_reset);

View File

@@ -2283,9 +2283,9 @@ int gk20a_mm_fb_flush(struct gk20a *g)
gk20a_dbg_fn(""); gk20a_dbg_fn("");
gk20a_busy_noresume(g->dev); gk20a_busy_noresume(g);
if (!g->power_on) { if (!g->power_on) {
gk20a_idle_nosuspend(g->dev); gk20a_idle_nosuspend(g);
return 0; return 0;
} }
@@ -2325,7 +2325,7 @@ int gk20a_mm_fb_flush(struct gk20a *g)
nvgpu_mutex_release(&mm->l2_op_lock); nvgpu_mutex_release(&mm->l2_op_lock);
gk20a_idle_nosuspend(g->dev); gk20a_idle_nosuspend(g);
return ret; return ret;
} }
@@ -2367,13 +2367,13 @@ static void gk20a_mm_l2_invalidate_locked(struct gk20a *g)
void gk20a_mm_l2_invalidate(struct gk20a *g) void gk20a_mm_l2_invalidate(struct gk20a *g)
{ {
struct mm_gk20a *mm = &g->mm; struct mm_gk20a *mm = &g->mm;
gk20a_busy_noresume(g->dev); gk20a_busy_noresume(g);
if (g->power_on) { if (g->power_on) {
nvgpu_mutex_acquire(&mm->l2_op_lock); nvgpu_mutex_acquire(&mm->l2_op_lock);
gk20a_mm_l2_invalidate_locked(g); gk20a_mm_l2_invalidate_locked(g);
nvgpu_mutex_release(&mm->l2_op_lock); nvgpu_mutex_release(&mm->l2_op_lock);
} }
gk20a_idle_nosuspend(g->dev); gk20a_idle_nosuspend(g);
} }
void gk20a_mm_l2_flush(struct gk20a *g, bool invalidate) void gk20a_mm_l2_flush(struct gk20a *g, bool invalidate)
@@ -2384,7 +2384,7 @@ void gk20a_mm_l2_flush(struct gk20a *g, bool invalidate)
gk20a_dbg_fn(""); gk20a_dbg_fn("");
gk20a_busy_noresume(g->dev); gk20a_busy_noresume(g);
if (!g->power_on) if (!g->power_on)
goto hw_was_off; goto hw_was_off;
@@ -2421,7 +2421,7 @@ void gk20a_mm_l2_flush(struct gk20a *g, bool invalidate)
nvgpu_mutex_release(&mm->l2_op_lock); nvgpu_mutex_release(&mm->l2_op_lock);
hw_was_off: hw_was_off:
gk20a_idle_nosuspend(g->dev); gk20a_idle_nosuspend(g);
} }
void gk20a_mm_cbc_clean(struct gk20a *g) void gk20a_mm_cbc_clean(struct gk20a *g)
@@ -2432,7 +2432,7 @@ void gk20a_mm_cbc_clean(struct gk20a *g)
gk20a_dbg_fn(""); gk20a_dbg_fn("");
gk20a_busy_noresume(g->dev); gk20a_busy_noresume(g);
if (!g->power_on) if (!g->power_on)
goto hw_was_off; goto hw_was_off;
@@ -2461,7 +2461,7 @@ void gk20a_mm_cbc_clean(struct gk20a *g)
nvgpu_mutex_release(&mm->l2_op_lock); nvgpu_mutex_release(&mm->l2_op_lock);
hw_was_off: hw_was_off:
gk20a_idle_nosuspend(g->dev); gk20a_idle_nosuspend(g);
} }
int nvgpu_vm_find_buf(struct vm_gk20a *vm, u64 gpu_va, int nvgpu_vm_find_buf(struct vm_gk20a *vm, u64 gpu_va,