d3883dc74a7565510c327a1ba8b4b14e100045c5
[openwrt/staging/lynxis.git] / target / linux / brcm2708 / patches-4.14 / 950-0177-drm-vc4-Convert-timers-to-use-timer_setup.patch
1 From 98f53bafea86a24d2ae510a72cb24234f6cbb7f2 Mon Sep 17 00:00:00 2001
2 From: Kees Cook <keescook@chromium.org>
3 Date: Tue, 24 Oct 2017 08:16:48 -0700
4 Subject: [PATCH 177/454] drm/vc4: Convert timers to use timer_setup()
5
6 In preparation for unconditionally passing the struct timer_list pointer to
7 all timer callbacks, switch to using the new timer_setup() and from_timer()
8 to pass the timer pointer explicitly.
9
10 Cc: Eric Anholt <eric@anholt.net>
11 Cc: David Airlie <airlied@linux.ie>
12 Cc: dri-devel@lists.freedesktop.org
13 Signed-off-by: Kees Cook <keescook@chromium.org>
14 Signed-off-by: Eric Anholt <eric@anholt.net>
15 Link: https://patchwork.freedesktop.org/patch/msgid/20171024151648.GA104538@beast
16 Reviewed-by: Eric Anholt <eric@anholt.net>
17 (cherry picked from commit 33b54ea1109721dcd07d3f7ee753c07482021eed)
18 ---
19 drivers/gpu/drm/vc4/vc4_bo.c | 9 +++------
20 drivers/gpu/drm/vc4/vc4_gem.c | 10 ++++------
21 2 files changed, 7 insertions(+), 12 deletions(-)
22
23 --- a/drivers/gpu/drm/vc4/vc4_bo.c
24 +++ b/drivers/gpu/drm/vc4/vc4_bo.c
25 @@ -677,10 +677,9 @@ void vc4_bo_dec_usecnt(struct vc4_bo *bo
26 mutex_unlock(&bo->madv_lock);
27 }
28
29 -static void vc4_bo_cache_time_timer(unsigned long data)
30 +static void vc4_bo_cache_time_timer(struct timer_list *t)
31 {
32 - struct drm_device *dev = (struct drm_device *)data;
33 - struct vc4_dev *vc4 = to_vc4_dev(dev);
34 + struct vc4_dev *vc4 = from_timer(vc4, t, bo_cache.time_timer);
35
36 schedule_work(&vc4->bo_cache.time_work);
37 }
38 @@ -1042,9 +1041,7 @@ int vc4_bo_cache_init(struct drm_device
39 INIT_LIST_HEAD(&vc4->bo_cache.time_list);
40
41 INIT_WORK(&vc4->bo_cache.time_work, vc4_bo_cache_time_work);
42 - setup_timer(&vc4->bo_cache.time_timer,
43 - vc4_bo_cache_time_timer,
44 - (unsigned long)dev);
45 + timer_setup(&vc4->bo_cache.time_timer, vc4_bo_cache_time_timer, 0);
46
47 return 0;
48 }
49 --- a/drivers/gpu/drm/vc4/vc4_gem.c
50 +++ b/drivers/gpu/drm/vc4/vc4_gem.c
51 @@ -312,10 +312,10 @@ vc4_reset_work(struct work_struct *work)
52 }
53
54 static void
55 -vc4_hangcheck_elapsed(unsigned long data)
56 +vc4_hangcheck_elapsed(struct timer_list *t)
57 {
58 - struct drm_device *dev = (struct drm_device *)data;
59 - struct vc4_dev *vc4 = to_vc4_dev(dev);
60 + struct vc4_dev *vc4 = from_timer(vc4, t, hangcheck.timer);
61 + struct drm_device *dev = vc4->dev;
62 uint32_t ct0ca, ct1ca;
63 unsigned long irqflags;
64 struct vc4_exec_info *bin_exec, *render_exec;
65 @@ -1156,9 +1156,7 @@ vc4_gem_init(struct drm_device *dev)
66 spin_lock_init(&vc4->job_lock);
67
68 INIT_WORK(&vc4->hangcheck.reset_work, vc4_reset_work);
69 - setup_timer(&vc4->hangcheck.timer,
70 - vc4_hangcheck_elapsed,
71 - (unsigned long)dev);
72 + timer_setup(&vc4->hangcheck.timer, vc4_hangcheck_elapsed, 0);
73
74 INIT_WORK(&vc4->job_done_work, vc4_job_done_work);
75