From 9f65627d0edaa45d914d2d180caf1b687e3c0d09 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Mon, 19 Jun 2017 14:13:14 -0700 Subject: 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 Reviewed-on: http://git-master/r/1505177 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/module.c | 14 +++++++------- drivers/gpu/nvgpu/gk20a/gk20a.h | 4 ++-- drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 18 +++++++++--------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c index 7c7cc714..b1638b9e 100644 --- a/drivers/gpu/nvgpu/common/linux/module.c +++ b/drivers/gpu/nvgpu/common/linux/module.c @@ -51,9 +51,9 @@ #define CREATE_TRACE_POINTS #include -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) @@ -103,9 +103,9 @@ fail: 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) @@ -760,7 +760,7 @@ static int gk20a_pm_suspend(struct device *dev) int ret = 0; if (g->user_railgate_disabled) - gk20a_idle_nosuspend(dev); + gk20a_idle_nosuspend(g); if (atomic_read(&dev->power.usage_count) > 1) { ret = -EBUSY; @@ -783,7 +783,7 @@ static int gk20a_pm_suspend(struct device *dev) fail: if (g->user_railgate_disabled) - gk20a_busy_noresume(dev); + gk20a_busy_noresume(g); return ret; } @@ -794,7 +794,7 @@ static int gk20a_pm_resume(struct device *dev) int ret = 0; if (g->user_railgate_disabled) - gk20a_busy_noresume(dev); + gk20a_busy_noresume(g); if (!g->suspended) return 0; diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 843a9e91..f91e86df 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -1475,8 +1475,8 @@ void gk20a_remove_sysfs(struct device *dev); #define GK20A_BAR1_IORESOURCE_MEM 1 #define GK20A_SIM_IORESOURCE_MEM 2 -void gk20a_busy_noresume(struct device *dev); -void gk20a_idle_nosuspend(struct device *dev); +void gk20a_busy_noresume(struct gk20a *g); +void gk20a_idle_nosuspend(struct gk20a *g); int __must_check gk20a_busy(struct gk20a *g); void gk20a_idle(struct gk20a *g); int __gk20a_do_idle(struct gk20a *g, bool force_reset); diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index e7bcf6f0..5ffa3e2f 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c @@ -2283,9 +2283,9 @@ int gk20a_mm_fb_flush(struct gk20a *g) gk20a_dbg_fn(""); - gk20a_busy_noresume(g->dev); + gk20a_busy_noresume(g); if (!g->power_on) { - gk20a_idle_nosuspend(g->dev); + gk20a_idle_nosuspend(g); return 0; } @@ -2325,7 +2325,7 @@ int gk20a_mm_fb_flush(struct gk20a *g) nvgpu_mutex_release(&mm->l2_op_lock); - gk20a_idle_nosuspend(g->dev); + gk20a_idle_nosuspend(g); return ret; } @@ -2367,13 +2367,13 @@ static void gk20a_mm_l2_invalidate_locked(struct gk20a *g) void gk20a_mm_l2_invalidate(struct gk20a *g) { struct mm_gk20a *mm = &g->mm; - gk20a_busy_noresume(g->dev); + gk20a_busy_noresume(g); if (g->power_on) { nvgpu_mutex_acquire(&mm->l2_op_lock); gk20a_mm_l2_invalidate_locked(g); 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) @@ -2384,7 +2384,7 @@ void gk20a_mm_l2_flush(struct gk20a *g, bool invalidate) gk20a_dbg_fn(""); - gk20a_busy_noresume(g->dev); + gk20a_busy_noresume(g); if (!g->power_on) 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); hw_was_off: - gk20a_idle_nosuspend(g->dev); + gk20a_idle_nosuspend(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_busy_noresume(g->dev); + gk20a_busy_noresume(g); if (!g->power_on) goto hw_was_off; @@ -2461,7 +2461,7 @@ void gk20a_mm_cbc_clean(struct gk20a *g) nvgpu_mutex_release(&mm->l2_op_lock); hw_was_off: - gk20a_idle_nosuspend(g->dev); + gk20a_idle_nosuspend(g); } int nvgpu_vm_find_buf(struct vm_gk20a *vm, u64 gpu_va, -- cgit v1.2.2