diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2017-06-21 18:56:05 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-06-30 21:34:59 -0400 |
commit | bab823973b0630e2f4515d5aabbe4fb46cdf3195 (patch) | |
tree | 9e19ed71ed9a57b15a3f3b48ffbbbc1b196bf4d6 /drivers/gpu/nvgpu/gk20a | |
parent | 6f0fcbc667ca55ed25818467069853e6d750cd7d (diff) |
gpu: nvgpu: Use accessor for finding struct device
Use dev_from_gk20a() accessor whenever accessing struct device * from
struct gk20a.
JIRA NVGPU-38
Change-Id: Ide9fca3a56436c8f62e7872580a766c4c1e2353e
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master/r/1507930
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/cde_gk20a.c | 12 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 12 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 2 |
6 files changed, 19 insertions, 16 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c index 730ffe5c..0413ae6a 100644 --- a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include "cde_gk20a.h" | 37 | #include "cde_gk20a.h" |
38 | #include "fence_gk20a.h" | 38 | #include "fence_gk20a.h" |
39 | #include "gr_gk20a.h" | 39 | #include "gr_gk20a.h" |
40 | #include "platform_gk20a.h" | ||
40 | 41 | ||
41 | #include <nvgpu/hw/gk20a/hw_ccsr_gk20a.h> | 42 | #include <nvgpu/hw/gk20a/hw_ccsr_gk20a.h> |
42 | #include <nvgpu/hw/gk20a/hw_pbdma_gk20a.h> | 43 | #include <nvgpu/hw/gk20a/hw_pbdma_gk20a.h> |
@@ -915,7 +916,7 @@ static struct gk20a_cde_ctx *gk20a_cde_allocate_context(struct gk20a *g) | |||
915 | return ERR_PTR(-ENOMEM); | 916 | return ERR_PTR(-ENOMEM); |
916 | 917 | ||
917 | cde_ctx->g = g; | 918 | cde_ctx->g = g; |
918 | cde_ctx->dev = g->dev; | 919 | cde_ctx->dev = dev_from_gk20a(g); |
919 | 920 | ||
920 | ret = gk20a_cde_load(cde_ctx); | 921 | ret = gk20a_cde_load(cde_ctx); |
921 | if (ret) { | 922 | if (ret) { |
@@ -982,7 +983,8 @@ __releases(&cde_app->mutex) | |||
982 | /* First, map the buffer to local va */ | 983 | /* First, map the buffer to local va */ |
983 | 984 | ||
984 | /* ensure that the compbits buffer has drvdata */ | 985 | /* ensure that the compbits buffer has drvdata */ |
985 | err = gk20a_dmabuf_alloc_drvdata(compbits_scatter_buf, g->dev); | 986 | err = gk20a_dmabuf_alloc_drvdata(compbits_scatter_buf, |
987 | dev_from_gk20a(g)); | ||
986 | if (err) | 988 | if (err) |
987 | goto exit_idle; | 989 | goto exit_idle; |
988 | 990 | ||
@@ -1048,7 +1050,7 @@ __releases(&cde_app->mutex) | |||
1048 | 1050 | ||
1049 | gk20a_dbg(gpu_dbg_cde, "surface=0x%p scatterBuffer=0x%p", | 1051 | gk20a_dbg(gpu_dbg_cde, "surface=0x%p scatterBuffer=0x%p", |
1050 | surface, scatter_buffer); | 1052 | surface, scatter_buffer); |
1051 | sgt = gk20a_mm_pin(g->dev, compbits_scatter_buf); | 1053 | sgt = gk20a_mm_pin(dev_from_gk20a(g), compbits_scatter_buf); |
1052 | if (IS_ERR(sgt)) { | 1054 | if (IS_ERR(sgt)) { |
1053 | nvgpu_warn(g, | 1055 | nvgpu_warn(g, |
1054 | "mm_pin failed"); | 1056 | "mm_pin failed"); |
@@ -1060,7 +1062,7 @@ __releases(&cde_app->mutex) | |||
1060 | scatterbuffer_size); | 1062 | scatterbuffer_size); |
1061 | WARN_ON(err); | 1063 | WARN_ON(err); |
1062 | 1064 | ||
1063 | gk20a_mm_unpin(g->dev, compbits_scatter_buf, | 1065 | gk20a_mm_unpin(dev_from_gk20a(g), compbits_scatter_buf, |
1064 | sgt); | 1066 | sgt); |
1065 | if (err) | 1067 | if (err) |
1066 | goto exit_unmap_surface; | 1068 | goto exit_unmap_surface; |
@@ -1072,7 +1074,7 @@ __releases(&cde_app->mutex) | |||
1072 | } | 1074 | } |
1073 | 1075 | ||
1074 | /* store source buffer compression tags */ | 1076 | /* store source buffer compression tags */ |
1075 | gk20a_get_comptags(g->dev, compbits_scatter_buf, &comptags); | 1077 | gk20a_get_comptags(dev_from_gk20a(g), compbits_scatter_buf, &comptags); |
1076 | cde_ctx->surf_param_offset = comptags.offset; | 1078 | cde_ctx->surf_param_offset = comptags.offset; |
1077 | cde_ctx->surf_param_lines = comptags.lines; | 1079 | cde_ctx->surf_param_lines = comptags.lines; |
1078 | 1080 | ||
diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c index 546d2eb1..54986e6c 100644 --- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c | |||
@@ -134,7 +134,7 @@ static int gk20a_dbg_gpu_do_dev_open(struct inode *inode, | |||
134 | if (!g) | 134 | if (!g) |
135 | return -ENODEV; | 135 | return -ENODEV; |
136 | 136 | ||
137 | dev = g->dev; | 137 | dev = dev_from_gk20a(g); |
138 | 138 | ||
139 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_gpu_dbg, "dbg session: %s", g->name); | 139 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_gpu_dbg, "dbg session: %s", g->name); |
140 | 140 | ||
diff --git a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c index 4235788b..aca9df75 100644 --- a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | |||
@@ -536,7 +536,7 @@ DEFINE_SIMPLE_ATTRIBUTE(gk20a_fecs_trace_debugfs_write_fops, | |||
536 | 536 | ||
537 | static void gk20a_fecs_trace_debugfs_init(struct gk20a *g) | 537 | static void gk20a_fecs_trace_debugfs_init(struct gk20a *g) |
538 | { | 538 | { |
539 | struct gk20a_platform *plat = dev_get_drvdata(g->dev); | 539 | struct gk20a_platform *plat = dev_get_drvdata(dev_from_gk20a(g)); |
540 | 540 | ||
541 | debugfs_create_file("ctxsw_trace_read", 0600, plat->debugfs, g, | 541 | debugfs_create_file("ctxsw_trace_read", 0600, plat->debugfs, g, |
542 | &gk20a_fecs_trace_debugfs_read_fops); | 542 | &gk20a_fecs_trace_debugfs_read_fops); |
@@ -548,7 +548,7 @@ static void gk20a_fecs_trace_debugfs_init(struct gk20a *g) | |||
548 | 548 | ||
549 | static void gk20a_fecs_trace_debugfs_cleanup(struct gk20a *g) | 549 | static void gk20a_fecs_trace_debugfs_cleanup(struct gk20a *g) |
550 | { | 550 | { |
551 | struct gk20a_platform *plat = dev_get_drvdata(g->dev); | 551 | struct gk20a_platform *plat = dev_get_drvdata(dev_from_gk20a(g)); |
552 | 552 | ||
553 | debugfs_remove_recursive(plat->debugfs); | 553 | debugfs_remove_recursive(plat->debugfs); |
554 | } | 554 | } |
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index a87d34f9..9452e153 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c | |||
@@ -42,7 +42,6 @@ | |||
42 | #include "pstate/pstate.h" | 42 | #include "pstate/pstate.h" |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | |||
46 | #ifdef CONFIG_TEGRA_19x_GPU | 45 | #ifdef CONFIG_TEGRA_19x_GPU |
47 | #include "nvgpu_gpuid_t19x.h" | 46 | #include "nvgpu_gpuid_t19x.h" |
48 | #endif | 47 | #endif |
@@ -152,7 +151,7 @@ int gk20a_prepare_poweroff(struct gk20a *g) | |||
152 | 151 | ||
153 | int gk20a_finalize_poweron(struct gk20a *g) | 152 | int gk20a_finalize_poweron(struct gk20a *g) |
154 | { | 153 | { |
155 | struct gk20a_platform *platform = gk20a_get_platform(g->dev); | 154 | struct gk20a_platform *platform = gk20a_get_platform(dev_from_gk20a(g)); |
156 | int err; | 155 | int err; |
157 | 156 | ||
158 | gk20a_dbg_fn(""); | 157 | gk20a_dbg_fn(""); |
@@ -323,7 +322,7 @@ int gk20a_finalize_poweron(struct gk20a *g) | |||
323 | if (platform->disable_aspm && g->ops.xve.disable_aspm) | 322 | if (platform->disable_aspm && g->ops.xve.disable_aspm) |
324 | g->ops.xve.disable_aspm(g); | 323 | g->ops.xve.disable_aspm(g); |
325 | 324 | ||
326 | g->ops.xve.sw_init(g->dev); | 325 | g->ops.xve.sw_init(dev_from_gk20a(g)); |
327 | g->ops.xve.available_speeds(g, &speed); | 326 | g->ops.xve.available_speeds(g, &speed); |
328 | 327 | ||
329 | /* Set to max speed */ | 328 | /* Set to max speed */ |
@@ -367,7 +366,7 @@ void gk20a_driver_start_unload(struct gk20a *g) | |||
367 | if (g->is_virtual) | 366 | if (g->is_virtual) |
368 | return; | 367 | return; |
369 | 368 | ||
370 | gk20a_wait_for_idle(g->dev); | 369 | gk20a_wait_for_idle(dev_from_gk20a(g)); |
371 | 370 | ||
372 | nvgpu_wait_for_deferred_interrupts(g); | 371 | nvgpu_wait_for_deferred_interrupts(g); |
373 | gk20a_channel_cancel_pending_sema_waits(g); | 372 | gk20a_channel_cancel_pending_sema_waits(g); |
@@ -407,7 +406,7 @@ int gk20a_wait_for_idle(struct device *dev) | |||
407 | int gk20a_init_gpu_characteristics(struct gk20a *g) | 406 | int gk20a_init_gpu_characteristics(struct gk20a *g) |
408 | { | 407 | { |
409 | struct nvgpu_gpu_characteristics *gpu = &g->gpu_characteristics; | 408 | struct nvgpu_gpu_characteristics *gpu = &g->gpu_characteristics; |
410 | struct gk20a_platform *platform = dev_get_drvdata(g->dev); | 409 | struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); |
411 | 410 | ||
412 | gpu->L2_cache_size = g->ops.ltc.determine_L2_size_bytes(g); | 411 | gpu->L2_cache_size = g->ops.ltc.determine_L2_size_bytes(g); |
413 | gpu->on_board_video_memory_size = 0; /* integrated GPU */ | 412 | gpu->on_board_video_memory_size = 0; /* integrated GPU */ |
@@ -499,7 +498,8 @@ int gk20a_init_gpu_characteristics(struct gk20a *g) | |||
499 | gpu->map_buffer_batch_limit = 256; | 498 | gpu->map_buffer_batch_limit = 256; |
500 | 499 | ||
501 | if (platform->clk_round_rate) | 500 | if (platform->clk_round_rate) |
502 | gpu->max_freq = platform->clk_round_rate(g->dev, UINT_MAX); | 501 | gpu->max_freq = platform->clk_round_rate(dev_from_gk20a(g), |
502 | UINT_MAX); | ||
503 | 503 | ||
504 | g->ops.gr.get_preemption_mode_flags(g, &g->gr.preemption_mode_rec); | 504 | g->ops.gr.get_preemption_mode_flags(g, &g->gr.preemption_mode_rec); |
505 | gpu->graphics_preemption_mode_flags = | 505 | gpu->graphics_preemption_mode_flags = |
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index 3ac4e397..570aad18 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include "regops_gk20a.h" | 39 | #include "regops_gk20a.h" |
40 | #include "dbg_gpu_gk20a.h" | 40 | #include "dbg_gpu_gk20a.h" |
41 | #include "ctxsw_trace_gk20a.h" | 41 | #include "ctxsw_trace_gk20a.h" |
42 | #include "platform_gk20a.h" | ||
42 | 43 | ||
43 | #include <nvgpu/hw/gk20a/hw_ccsr_gk20a.h> | 44 | #include <nvgpu/hw/gk20a/hw_ccsr_gk20a.h> |
44 | #include <nvgpu/hw/gk20a/hw_ctxsw_prog_gk20a.h> | 45 | #include <nvgpu/hw/gk20a/hw_ctxsw_prog_gk20a.h> |
@@ -4826,7 +4827,7 @@ static int gk20a_init_gr_setup_sw(struct gk20a *g) | |||
4826 | gr->sw_ready = true; | 4827 | gr->sw_ready = true; |
4827 | 4828 | ||
4828 | if (g->ops.gr.create_gr_sysfs) | 4829 | if (g->ops.gr.create_gr_sysfs) |
4829 | g->ops.gr.create_gr_sysfs(g->dev); | 4830 | g->ops.gr.create_gr_sysfs(dev_from_gk20a(g)); |
4830 | 4831 | ||
4831 | gk20a_dbg_fn("done"); | 4832 | gk20a_dbg_fn("done"); |
4832 | return 0; | 4833 | return 0; |
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index 9cc4f58e..b7b68575 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c | |||
@@ -1992,7 +1992,7 @@ int gk20a_dmabuf_get_state(struct dma_buf *dmabuf, struct gk20a *g, | |||
1992 | int err = 0; | 1992 | int err = 0; |
1993 | struct gk20a_dmabuf_priv *priv; | 1993 | struct gk20a_dmabuf_priv *priv; |
1994 | struct gk20a_buffer_state *s; | 1994 | struct gk20a_buffer_state *s; |
1995 | struct device *dev = g->dev; | 1995 | struct device *dev = dev_from_gk20a(g); |
1996 | 1996 | ||
1997 | if (WARN_ON(offset >= (u64)dmabuf->size)) | 1997 | if (WARN_ON(offset >= (u64)dmabuf->size)) |
1998 | return -EINVAL; | 1998 | return -EINVAL; |