f6fe9e1a4c20b266355f4f7f76a384f26c64fe70
[openwrt/staging/blocktrron.git] /
1 From 9e2b5f6b8d74b18c96521c3e9ddd3f7fc75d917f Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Wed, 25 Jan 2023 12:54:36 +0100
4 Subject: [PATCH 0032/1085] drm/vc4: hvs: Move the dlist allocation destruction
5 to a function
6
7 We'll need to destroy a dlist allocation in multiple code paths, so
8 let's move it to a separate function.
9
10 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
11 ---
12 drivers/gpu/drm/vc4/vc4_hvs.c | 16 +++++++++++++---
13 1 file changed, 13 insertions(+), 3 deletions(-)
14
15 --- a/drivers/gpu/drm/vc4/vc4_hvs.c
16 +++ b/drivers/gpu/drm/vc4/vc4_hvs.c
17 @@ -466,6 +466,18 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs
18 return alloc;
19 }
20
21 +static void vc4_hvs_free_dlist_entry_locked(struct vc4_hvs *hvs,
22 + struct vc4_hvs_dlist_allocation *alloc)
23 +{
24 + lockdep_assert_held(&hvs->mm_lock);
25 +
26 + if (!list_empty(&alloc->node))
27 + list_del(&alloc->node);
28 +
29 + drm_mm_remove_node(&alloc->mm_node);
30 + kfree(alloc);
31 +}
32 +
33 void vc4_hvs_mark_dlist_entry_stale(struct vc4_hvs *hvs,
34 struct vc4_hvs_dlist_allocation *alloc)
35 {
36 @@ -553,9 +565,7 @@ static void vc4_hvs_dlist_free_work(stru
37 if (!vc4_hvs_frcnt_lte(cur->target_frame_count, frcnt))
38 continue;
39
40 - list_del(&cur->node);
41 - drm_mm_remove_node(&cur->mm_node);
42 - kfree(cur);
43 + vc4_hvs_free_dlist_entry_locked(hvs, cur);
44 }
45 spin_unlock_irqrestore(&hvs->mm_lock, flags);
46 }