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/common/linux/driver_common.c | |
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/common/linux/driver_common.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/driver_common.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/driver_common.c b/drivers/gpu/nvgpu/common/linux/driver_common.c index eb4f490f..c2bd9d78 100644 --- a/drivers/gpu/nvgpu/common/linux/driver_common.c +++ b/drivers/gpu/nvgpu/common/linux/driver_common.c | |||
@@ -35,7 +35,8 @@ | |||
35 | static void nvgpu_init_vars(struct gk20a *g) | 35 | static void nvgpu_init_vars(struct gk20a *g) |
36 | { | 36 | { |
37 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); | 37 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); |
38 | struct gk20a_platform *platform = dev_get_drvdata(g->dev); | 38 | struct device *dev = dev_from_gk20a(g); |
39 | struct gk20a_platform *platform = dev_get_drvdata(dev); | ||
39 | 40 | ||
40 | init_waitqueue_head(&g->sw_irq_stall_last_handled_wq); | 41 | init_waitqueue_head(&g->sw_irq_stall_last_handled_wq); |
41 | init_waitqueue_head(&g->sw_irq_nonstall_last_handled_wq); | 42 | init_waitqueue_head(&g->sw_irq_nonstall_last_handled_wq); |
@@ -57,8 +58,8 @@ static void nvgpu_init_vars(struct gk20a *g) | |||
57 | g->emc3d_ratio = EMC3D_DEFAULT_RATIO; | 58 | g->emc3d_ratio = EMC3D_DEFAULT_RATIO; |
58 | 59 | ||
59 | /* Set DMA parameters to allow larger sgt lists */ | 60 | /* Set DMA parameters to allow larger sgt lists */ |
60 | g->dev->dma_parms = &l->dma_parms; | 61 | dev->dma_parms = &l->dma_parms; |
61 | dma_set_max_seg_size(g->dev, UINT_MAX); | 62 | dma_set_max_seg_size(dev, UINT_MAX); |
62 | 63 | ||
63 | nvgpu_init_list_node(&g->pending_sema_waits); | 64 | nvgpu_init_list_node(&g->pending_sema_waits); |
64 | nvgpu_raw_spinlock_init(&g->pending_sema_waits_lock); | 65 | nvgpu_raw_spinlock_init(&g->pending_sema_waits_lock); |
@@ -68,7 +69,7 @@ static void nvgpu_init_vars(struct gk20a *g) | |||
68 | 69 | ||
69 | static void nvgpu_init_timeout(struct gk20a *g) | 70 | static void nvgpu_init_timeout(struct gk20a *g) |
70 | { | 71 | { |
71 | struct gk20a_platform *platform = dev_get_drvdata(g->dev); | 72 | struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); |
72 | 73 | ||
73 | g->gr_idle_timeout_default = CONFIG_GK20A_DEFAULT_TIMEOUT; | 74 | g->gr_idle_timeout_default = CONFIG_GK20A_DEFAULT_TIMEOUT; |
74 | if (nvgpu_platform_is_silicon(g)) | 75 | if (nvgpu_platform_is_silicon(g)) |
@@ -94,7 +95,7 @@ static void nvgpu_init_timeslice(struct gk20a *g) | |||
94 | 95 | ||
95 | static void nvgpu_init_pm_vars(struct gk20a *g) | 96 | static void nvgpu_init_pm_vars(struct gk20a *g) |
96 | { | 97 | { |
97 | struct gk20a_platform *platform = dev_get_drvdata(g->dev); | 98 | struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); |
98 | 99 | ||
99 | /* | 100 | /* |
100 | * Set up initial power settings. For non-slicon platforms, disable | 101 | * Set up initial power settings. For non-slicon platforms, disable |
@@ -119,7 +120,7 @@ static void nvgpu_init_pm_vars(struct gk20a *g) | |||
119 | g->aggressive_sync_destroy_thresh = platform->aggressive_sync_destroy_thresh; | 120 | g->aggressive_sync_destroy_thresh = platform->aggressive_sync_destroy_thresh; |
120 | g->has_syncpoints = platform->has_syncpoints; | 121 | g->has_syncpoints = platform->has_syncpoints; |
121 | g->ptimer_src_freq = platform->ptimer_src_freq; | 122 | g->ptimer_src_freq = platform->ptimer_src_freq; |
122 | g->support_pmu = support_gk20a_pmu(g->dev); | 123 | g->support_pmu = support_gk20a_pmu(dev_from_gk20a(g)); |
123 | g->can_railgate = platform->can_railgate_init; | 124 | g->can_railgate = platform->can_railgate_init; |
124 | g->railgate_delay = platform->railgate_delay_init; | 125 | g->railgate_delay = platform->railgate_delay_init; |
125 | 126 | ||
@@ -133,7 +134,7 @@ static void nvgpu_init_pm_vars(struct gk20a *g) | |||
133 | 134 | ||
134 | static void nvgpu_init_mm_vars(struct gk20a *g) | 135 | static void nvgpu_init_mm_vars(struct gk20a *g) |
135 | { | 136 | { |
136 | struct gk20a_platform *platform = dev_get_drvdata(g->dev); | 137 | struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); |
137 | 138 | ||
138 | g->mm.bypass_smmu = platform->bypass_smmu; | 139 | g->mm.bypass_smmu = platform->bypass_smmu; |
139 | g->mm.disable_bigpage = platform->disable_bigpage; | 140 | g->mm.disable_bigpage = platform->disable_bigpage; |
@@ -153,7 +154,8 @@ int nvgpu_probe(struct gk20a *g, | |||
153 | const char *interface_name, | 154 | const char *interface_name, |
154 | struct class *class) | 155 | struct class *class) |
155 | { | 156 | { |
156 | struct gk20a_platform *platform = dev_get_drvdata(g->dev); | 157 | struct device *dev = dev_from_gk20a(g); |
158 | struct gk20a_platform *platform = dev_get_drvdata(dev); | ||
157 | int err = 0; | 159 | int err = 0; |
158 | 160 | ||
159 | nvgpu_init_vars(g); | 161 | nvgpu_init_vars(g); |
@@ -162,7 +164,7 @@ int nvgpu_probe(struct gk20a *g, | |||
162 | nvgpu_init_pm_vars(g); | 164 | nvgpu_init_pm_vars(g); |
163 | 165 | ||
164 | /* Initialize the platform interface. */ | 166 | /* Initialize the platform interface. */ |
165 | err = platform->probe(g->dev); | 167 | err = platform->probe(dev); |
166 | if (err) { | 168 | if (err) { |
167 | if (err == -EPROBE_DEFER) | 169 | if (err == -EPROBE_DEFER) |
168 | nvgpu_info(g, "platform probe failed"); | 170 | nvgpu_info(g, "platform probe failed"); |
@@ -172,17 +174,17 @@ int nvgpu_probe(struct gk20a *g, | |||
172 | } | 174 | } |
173 | 175 | ||
174 | /* platform probe can defer do user init only if probe succeeds */ | 176 | /* platform probe can defer do user init only if probe succeeds */ |
175 | err = gk20a_user_init(g->dev, interface_name, class); | 177 | err = gk20a_user_init(dev, interface_name, class); |
176 | if (err) | 178 | if (err) |
177 | return err; | 179 | return err; |
178 | 180 | ||
179 | 181 | ||
180 | /* Initialise scaling */ | 182 | /* Initialise scaling */ |
181 | if (IS_ENABLED(CONFIG_GK20A_DEVFREQ)) | 183 | if (IS_ENABLED(CONFIG_GK20A_DEVFREQ)) |
182 | gk20a_scale_init(g->dev); | 184 | gk20a_scale_init(dev); |
183 | 185 | ||
184 | if (platform->late_probe) { | 186 | if (platform->late_probe) { |
185 | err = platform->late_probe(g->dev); | 187 | err = platform->late_probe(dev); |
186 | if (err) { | 188 | if (err) { |
187 | nvgpu_err(g, "late probe failed"); | 189 | nvgpu_err(g, "late probe failed"); |
188 | return err; | 190 | return err; |
@@ -191,7 +193,7 @@ int nvgpu_probe(struct gk20a *g, | |||
191 | 193 | ||
192 | nvgpu_init_mm_vars(g); | 194 | nvgpu_init_mm_vars(g); |
193 | 195 | ||
194 | nvgpu_create_sysfs(g->dev); | 196 | nvgpu_create_sysfs(dev); |
195 | gk20a_debug_init(g, debugfs_symlink); | 197 | gk20a_debug_init(g, debugfs_symlink); |
196 | 198 | ||
197 | g->dbg_regops_tmp_buf = nvgpu_kzalloc(g, SZ_4K); | 199 | g->dbg_regops_tmp_buf = nvgpu_kzalloc(g, SZ_4K); |