Skip to content

Commit 0078730

Browse files
committed
drm/vc4: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Eric Anholt <[email protected]> Cc: David Airlie <[email protected]> Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Eric Anholt <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/20171024151648.GA104538@beast Reviewed-by: Eric Anholt <[email protected]>
1 parent bca237a commit 0078730

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

drivers/gpu/drm/vc4/vc4_bo.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -674,10 +674,9 @@ void vc4_bo_dec_usecnt(struct vc4_bo *bo)
674674
mutex_unlock(&bo->madv_lock);
675675
}
676676

677-
static void vc4_bo_cache_time_timer(unsigned long data)
677+
static void vc4_bo_cache_time_timer(struct timer_list *t)
678678
{
679-
struct drm_device *dev = (struct drm_device *)data;
680-
struct vc4_dev *vc4 = to_vc4_dev(dev);
679+
struct vc4_dev *vc4 = from_timer(vc4, t, bo_cache.time_timer);
681680

682681
schedule_work(&vc4->bo_cache.time_work);
683682
}
@@ -1039,9 +1038,7 @@ int vc4_bo_cache_init(struct drm_device *dev)
10391038
INIT_LIST_HEAD(&vc4->bo_cache.time_list);
10401039

10411040
INIT_WORK(&vc4->bo_cache.time_work, vc4_bo_cache_time_work);
1042-
setup_timer(&vc4->bo_cache.time_timer,
1043-
vc4_bo_cache_time_timer,
1044-
(unsigned long)dev);
1041+
timer_setup(&vc4->bo_cache.time_timer, vc4_bo_cache_time_timer, 0);
10451042

10461043
return 0;
10471044
}

drivers/gpu/drm/vc4/vc4_gem.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,10 @@ vc4_reset_work(struct work_struct *work)
312312
}
313313

314314
static void
315-
vc4_hangcheck_elapsed(unsigned long data)
315+
vc4_hangcheck_elapsed(struct timer_list *t)
316316
{
317-
struct drm_device *dev = (struct drm_device *)data;
318-
struct vc4_dev *vc4 = to_vc4_dev(dev);
317+
struct vc4_dev *vc4 = from_timer(vc4, t, hangcheck.timer);
318+
struct drm_device *dev = vc4->dev;
319319
uint32_t ct0ca, ct1ca;
320320
unsigned long irqflags;
321321
struct vc4_exec_info *bin_exec, *render_exec;
@@ -1154,9 +1154,7 @@ vc4_gem_init(struct drm_device *dev)
11541154
spin_lock_init(&vc4->job_lock);
11551155

11561156
INIT_WORK(&vc4->hangcheck.reset_work, vc4_reset_work);
1157-
setup_timer(&vc4->hangcheck.timer,
1158-
vc4_hangcheck_elapsed,
1159-
(unsigned long)dev);
1157+
timer_setup(&vc4->hangcheck.timer, vc4_hangcheck_elapsed, 0);
11601158

11611159
INIT_WORK(&vc4->job_done_work, vc4_job_done_work);
11621160

0 commit comments

Comments
 (0)