Skip to content

Commit f610cdf

Browse files
keespopcornmix
authored andcommitted
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]> (cherry picked from commit 33b54ea)
1 parent dca645d commit f610cdf

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
@@ -675,10 +675,9 @@ void vc4_bo_dec_usecnt(struct vc4_bo *bo)
675675
mutex_unlock(&bo->madv_lock);
676676
}
677677

678-
static void vc4_bo_cache_time_timer(unsigned long data)
678+
static void vc4_bo_cache_time_timer(struct timer_list *t)
679679
{
680-
struct drm_device *dev = (struct drm_device *)data;
681-
struct vc4_dev *vc4 = to_vc4_dev(dev);
680+
struct vc4_dev *vc4 = from_timer(vc4, t, bo_cache.time_timer);
682681

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

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

10471044
return 0;
10481045
}

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;
@@ -1156,9 +1156,7 @@ vc4_gem_init(struct drm_device *dev)
11561156
spin_lock_init(&vc4->job_lock);
11571157

11581158
INIT_WORK(&vc4->hangcheck.reset_work, vc4_reset_work);
1159-
setup_timer(&vc4->hangcheck.timer,
1160-
vc4_hangcheck_elapsed,
1161-
(unsigned long)dev);
1159+
timer_setup(&vc4->hangcheck.timer, vc4_hangcheck_elapsed, 0);
11621160

11631161
INIT_WORK(&vc4->job_done_work, vc4_job_done_work);
11641162

0 commit comments

Comments
 (0)