Skip to content

Commit bc66252

Browse files
committed
drm/v3d: Delete v3d_dev->dev
We already have it in v3d_dev->drm.dev with zero additional pointer chasing. Personally I don't like duplicated pointers like this because: - reviewers need to check whether the pointer is for the same or different objects if there's multiple - compilers have an easier time too But also a bit a bikeshed, so feel free to ignore. Acked-by: Eric Anholt <eric@anholt.net> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-10-daniel.vetter@ffwll.ch
1 parent 235b7e7 commit bc66252

7 files changed

Lines changed: 37 additions & 38 deletions

File tree

‎drivers/gpu/drm/v3d/v3d_debugfs.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static int v3d_v3d_debugfs_ident(struct seq_file *m, void *unused)
132132
u32 ident0, ident1, ident2, ident3, cores;
133133
int ret, core;
134134

135-
ret = pm_runtime_get_sync(v3d->dev);
135+
ret = pm_runtime_get_sync(v3d->drm.dev);
136136
if (ret < 0)
137137
return ret;
138138

@@ -187,8 +187,8 @@ static int v3d_v3d_debugfs_ident(struct seq_file *m, void *unused)
187187
(misccfg & V3D_MISCCFG_OVRTMUOUT) != 0);
188188
}
189189

190-
pm_runtime_mark_last_busy(v3d->dev);
191-
pm_runtime_put_autosuspend(v3d->dev);
190+
pm_runtime_mark_last_busy(v3d->drm.dev);
191+
pm_runtime_put_autosuspend(v3d->drm.dev);
192192

193193
return 0;
194194
}
@@ -219,7 +219,7 @@ static int v3d_measure_clock(struct seq_file *m, void *unused)
219219
int measure_ms = 1000;
220220
int ret;
221221

222-
ret = pm_runtime_get_sync(v3d->dev);
222+
ret = pm_runtime_get_sync(v3d->drm.dev);
223223
if (ret < 0)
224224
return ret;
225225

@@ -245,8 +245,8 @@ static int v3d_measure_clock(struct seq_file *m, void *unused)
245245
cycles / (measure_ms * 1000),
246246
(cycles / (measure_ms * 100)) % 10);
247247

248-
pm_runtime_mark_last_busy(v3d->dev);
249-
pm_runtime_put_autosuspend(v3d->dev);
248+
pm_runtime_mark_last_busy(v3d->drm.dev);
249+
pm_runtime_put_autosuspend(v3d->drm.dev);
250250

251251
return 0;
252252
}

‎drivers/gpu/drm/v3d/v3d_drv.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static int v3d_get_param_ioctl(struct drm_device *dev, void *data,
105105
if (args->value != 0)
106106
return -EINVAL;
107107

108-
ret = pm_runtime_get_sync(v3d->dev);
108+
ret = pm_runtime_get_sync(v3d->drm.dev);
109109
if (ret < 0)
110110
return ret;
111111
if (args->param >= DRM_V3D_PARAM_V3D_CORE0_IDENT0 &&
@@ -114,8 +114,8 @@ static int v3d_get_param_ioctl(struct drm_device *dev, void *data,
114114
} else {
115115
args->value = V3D_READ(offset);
116116
}
117-
pm_runtime_mark_last_busy(v3d->dev);
118-
pm_runtime_put_autosuspend(v3d->dev);
117+
pm_runtime_mark_last_busy(v3d->drm.dev);
118+
pm_runtime_put_autosuspend(v3d->drm.dev);
119119
return 0;
120120
}
121121

@@ -237,7 +237,7 @@ map_regs(struct v3d_dev *v3d, void __iomem **regs, const char *name)
237237
struct resource *res =
238238
platform_get_resource_byname(v3d->pdev, IORESOURCE_MEM, name);
239239

240-
*regs = devm_ioremap_resource(v3d->dev, res);
240+
*regs = devm_ioremap_resource(v3d->drm.dev, res);
241241
return PTR_ERR_OR_ZERO(*regs);
242242
}
243243

@@ -255,7 +255,6 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
255255
if (IS_ERR(v3d))
256256
return PTR_ERR(v3d);
257257

258-
v3d->dev = dev;
259258
v3d->pdev = pdev;
260259
drm = &v3d->drm;
261260

@@ -345,7 +344,8 @@ static int v3d_platform_drm_remove(struct platform_device *pdev)
345344

346345
v3d_gem_destroy(drm);
347346

348-
dma_free_wc(v3d->dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
347+
dma_free_wc(v3d->drm.dev, 4096, v3d->mmu_scratch,
348+
v3d->mmu_scratch_paddr);
349349

350350
return 0;
351351
}

‎drivers/gpu/drm/v3d/v3d_drv.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "uapi/drm/v3d_drm.h"
1515

1616
struct clk;
17-
struct device;
1817
struct platform_device;
1918
struct reset_control;
2019

@@ -47,7 +46,6 @@ struct v3d_dev {
4746
int ver;
4847
bool single_irq_line;
4948

50-
struct device *dev;
5149
struct platform_device *pdev;
5250
void __iomem *hub_regs;
5351
void __iomem *core_regs[3];

‎drivers/gpu/drm/v3d/v3d_gem.c‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,8 @@ v3d_job_free(struct kref *ref)
370370
dma_fence_put(job->irq_fence);
371371
dma_fence_put(job->done_fence);
372372

373-
pm_runtime_mark_last_busy(job->v3d->dev);
374-
pm_runtime_put_autosuspend(job->v3d->dev);
373+
pm_runtime_mark_last_busy(job->v3d->drm.dev);
374+
pm_runtime_put_autosuspend(job->v3d->drm.dev);
375375

376376
kfree(job);
377377
}
@@ -439,7 +439,7 @@ v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv,
439439
job->v3d = v3d;
440440
job->free = free;
441441

442-
ret = pm_runtime_get_sync(v3d->dev);
442+
ret = pm_runtime_get_sync(v3d->drm.dev);
443443
if (ret < 0)
444444
return ret;
445445

@@ -458,7 +458,7 @@ v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv,
458458
return 0;
459459
fail:
460460
xa_destroy(&job->deps);
461-
pm_runtime_put_autosuspend(v3d->dev);
461+
pm_runtime_put_autosuspend(v3d->drm.dev);
462462
return ret;
463463
}
464464

@@ -886,12 +886,12 @@ v3d_gem_init(struct drm_device *dev)
886886
*/
887887
drm_mm_init(&v3d->mm, 1, pt_size / sizeof(u32) - 1);
888888

889-
v3d->pt = dma_alloc_wc(v3d->dev, pt_size,
889+
v3d->pt = dma_alloc_wc(v3d->drm.dev, pt_size,
890890
&v3d->pt_paddr,
891891
GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO);
892892
if (!v3d->pt) {
893893
drm_mm_takedown(&v3d->mm);
894-
dev_err(v3d->dev,
894+
dev_err(v3d->drm.dev,
895895
"Failed to allocate page tables. "
896896
"Please ensure you have CMA enabled.\n");
897897
return -ENOMEM;
@@ -903,7 +903,7 @@ v3d_gem_init(struct drm_device *dev)
903903
ret = v3d_sched_init(v3d);
904904
if (ret) {
905905
drm_mm_takedown(&v3d->mm);
906-
dma_free_coherent(v3d->dev, 4096 * 1024, (void *)v3d->pt,
906+
dma_free_coherent(v3d->drm.dev, 4096 * 1024, (void *)v3d->pt,
907907
v3d->pt_paddr);
908908
}
909909

@@ -925,5 +925,6 @@ v3d_gem_destroy(struct drm_device *dev)
925925

926926
drm_mm_takedown(&v3d->mm);
927927

928-
dma_free_coherent(v3d->dev, 4096 * 1024, (void *)v3d->pt, v3d->pt_paddr);
928+
dma_free_coherent(v3d->drm.dev, 4096 * 1024, (void *)v3d->pt,
929+
v3d->pt_paddr);
929930
}

‎drivers/gpu/drm/v3d/v3d_irq.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ v3d_irq(int irq, void *arg)
128128
* always-allowed mode.
129129
*/
130130
if (intsts & V3D_INT_GMPV)
131-
dev_err(v3d->dev, "GMP violation\n");
131+
dev_err(v3d->drm.dev, "GMP violation\n");
132132

133133
/* V3D 4.2 wires the hub and core IRQs together, so if we &
134134
* didn't see the common one then check hub for MMU IRQs.
@@ -189,7 +189,7 @@ v3d_hub_irq(int irq, void *arg)
189189
client = v3d41_axi_ids[axi_id];
190190
}
191191

192-
dev_err(v3d->dev, "MMU error from client %s (%d) at 0x%llx%s%s%s\n",
192+
dev_err(v3d->drm.dev, "MMU error from client %s (%d) at 0x%llx%s%s%s\n",
193193
client, axi_id, (long long)vio_addr,
194194
((intsts & V3D_HUB_INT_MMU_WRV) ?
195195
", write violation" : ""),
@@ -221,20 +221,20 @@ v3d_irq_init(struct v3d_dev *v3d)
221221
if (irq1 == -EPROBE_DEFER)
222222
return irq1;
223223
if (irq1 > 0) {
224-
ret = devm_request_irq(v3d->dev, irq1,
224+
ret = devm_request_irq(v3d->drm.dev, irq1,
225225
v3d_irq, IRQF_SHARED,
226226
"v3d_core0", v3d);
227227
if (ret)
228228
goto fail;
229-
ret = devm_request_irq(v3d->dev, platform_get_irq(v3d->pdev, 0),
229+
ret = devm_request_irq(v3d->drm.dev, platform_get_irq(v3d->pdev, 0),
230230
v3d_hub_irq, IRQF_SHARED,
231231
"v3d_hub", v3d);
232232
if (ret)
233233
goto fail;
234234
} else {
235235
v3d->single_irq_line = true;
236236

237-
ret = devm_request_irq(v3d->dev, platform_get_irq(v3d->pdev, 0),
237+
ret = devm_request_irq(v3d->drm.dev, platform_get_irq(v3d->pdev, 0),
238238
v3d_irq, IRQF_SHARED,
239239
"v3d", v3d);
240240
if (ret)
@@ -246,7 +246,7 @@ v3d_irq_init(struct v3d_dev *v3d)
246246

247247
fail:
248248
if (ret != -EPROBE_DEFER)
249-
dev_err(v3d->dev, "IRQ setup failed: %d\n", ret);
249+
dev_err(v3d->drm.dev, "IRQ setup failed: %d\n", ret);
250250
return ret;
251251
}
252252

‎drivers/gpu/drm/v3d/v3d_mmu.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static int v3d_mmu_flush_all(struct v3d_dev *v3d)
4040
ret = wait_for(!(V3D_READ(V3D_MMU_CTL) &
4141
V3D_MMU_CTL_TLB_CLEARING), 100);
4242
if (ret)
43-
dev_err(v3d->dev, "TLB clear wait idle pre-wait failed\n");
43+
dev_err(v3d->drm.dev, "TLB clear wait idle pre-wait failed\n");
4444

4545
V3D_WRITE(V3D_MMU_CTL, V3D_READ(V3D_MMU_CTL) |
4646
V3D_MMU_CTL_TLB_CLEAR);
@@ -52,14 +52,14 @@ static int v3d_mmu_flush_all(struct v3d_dev *v3d)
5252
ret = wait_for(!(V3D_READ(V3D_MMU_CTL) &
5353
V3D_MMU_CTL_TLB_CLEARING), 100);
5454
if (ret) {
55-
dev_err(v3d->dev, "TLB clear wait idle failed\n");
55+
dev_err(v3d->drm.dev, "TLB clear wait idle failed\n");
5656
return ret;
5757
}
5858

5959
ret = wait_for(!(V3D_READ(V3D_MMUC_CONTROL) &
6060
V3D_MMUC_CONTROL_FLUSHING), 100);
6161
if (ret)
62-
dev_err(v3d->dev, "MMUC flush wait idle failed\n");
62+
dev_err(v3d->drm.dev, "MMUC flush wait idle failed\n");
6363

6464
return ret;
6565
}
@@ -109,7 +109,7 @@ void v3d_mmu_insert_ptes(struct v3d_bo *bo)
109109
shmem_obj->base.size >> V3D_MMU_PAGE_SHIFT);
110110

111111
if (v3d_mmu_flush_all(v3d))
112-
dev_err(v3d->dev, "MMU flush timeout\n");
112+
dev_err(v3d->drm.dev, "MMU flush timeout\n");
113113
}
114114

115115
void v3d_mmu_remove_ptes(struct v3d_bo *bo)
@@ -122,5 +122,5 @@ void v3d_mmu_remove_ptes(struct v3d_bo *bo)
122122
v3d->pt[page] = 0;
123123

124124
if (v3d_mmu_flush_all(v3d))
125-
dev_err(v3d->dev, "MMU flush timeout\n");
125+
dev_err(v3d->drm.dev, "MMU flush timeout\n");
126126
}

‎drivers/gpu/drm/v3d/v3d_sched.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ v3d_sched_init(struct v3d_dev *v3d)
403403
msecs_to_jiffies(hang_limit_ms),
404404
"v3d_bin");
405405
if (ret) {
406-
dev_err(v3d->dev, "Failed to create bin scheduler: %d.", ret);
406+
dev_err(v3d->drm.dev, "Failed to create bin scheduler: %d.", ret);
407407
return ret;
408408
}
409409

@@ -413,7 +413,7 @@ v3d_sched_init(struct v3d_dev *v3d)
413413
msecs_to_jiffies(hang_limit_ms),
414414
"v3d_render");
415415
if (ret) {
416-
dev_err(v3d->dev, "Failed to create render scheduler: %d.",
416+
dev_err(v3d->drm.dev, "Failed to create render scheduler: %d.",
417417
ret);
418418
v3d_sched_fini(v3d);
419419
return ret;
@@ -425,7 +425,7 @@ v3d_sched_init(struct v3d_dev *v3d)
425425
msecs_to_jiffies(hang_limit_ms),
426426
"v3d_tfu");
427427
if (ret) {
428-
dev_err(v3d->dev, "Failed to create TFU scheduler: %d.",
428+
dev_err(v3d->drm.dev, "Failed to create TFU scheduler: %d.",
429429
ret);
430430
v3d_sched_fini(v3d);
431431
return ret;
@@ -438,7 +438,7 @@ v3d_sched_init(struct v3d_dev *v3d)
438438
msecs_to_jiffies(hang_limit_ms),
439439
"v3d_csd");
440440
if (ret) {
441-
dev_err(v3d->dev, "Failed to create CSD scheduler: %d.",
441+
dev_err(v3d->drm.dev, "Failed to create CSD scheduler: %d.",
442442
ret);
443443
v3d_sched_fini(v3d);
444444
return ret;
@@ -450,7 +450,7 @@ v3d_sched_init(struct v3d_dev *v3d)
450450
msecs_to_jiffies(hang_limit_ms),
451451
"v3d_cache_clean");
452452
if (ret) {
453-
dev_err(v3d->dev, "Failed to create CACHE_CLEAN scheduler: %d.",
453+
dev_err(v3d->drm.dev, "Failed to create CACHE_CLEAN scheduler: %d.",
454454
ret);
455455
v3d_sched_fini(v3d);
456456
return ret;

0 commit comments

Comments
 (0)