openwrt/target/linux/bcm27xx/patches-6.6/950-0032-drm-vc4-hvs-Move-the-dlist-allocation-destruction-to.patch
Álvaro Fernández Rojas 8c405cdccc bcm27xx: add 6.6 kernel patches
The patches were generated from the RPi repo with the following command:
git format-patch v6.6.34..rpi-6.1.y

Some patches needed rebasing and, as usual, the applied and reverted, wireless
drivers, Github workflows, READMEs and defconfigs patches were removed.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2024-06-18 18:52:49 +02:00

47 lines
1.3 KiB
Diff

From 9e2b5f6b8d74b18c96521c3e9ddd3f7fc75d917f Mon Sep 17 00:00:00 2001
From: Maxime Ripard <maxime@cerno.tech>
Date: Wed, 25 Jan 2023 12:54:36 +0100
Subject: [PATCH 0032/1085] drm/vc4: hvs: Move the dlist allocation destruction
to a function
We'll need to destroy a dlist allocation in multiple code paths, so
let's move it to a separate function.
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
drivers/gpu/drm/vc4/vc4_hvs.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_hvs.c
+++ b/drivers/gpu/drm/vc4/vc4_hvs.c
@@ -466,6 +466,18 @@ vc4_hvs_alloc_dlist_entry(struct vc4_hvs
return alloc;
}
+static void vc4_hvs_free_dlist_entry_locked(struct vc4_hvs *hvs,
+ struct vc4_hvs_dlist_allocation *alloc)
+{
+ lockdep_assert_held(&hvs->mm_lock);
+
+ if (!list_empty(&alloc->node))
+ list_del(&alloc->node);
+
+ drm_mm_remove_node(&alloc->mm_node);
+ kfree(alloc);
+}
+
void vc4_hvs_mark_dlist_entry_stale(struct vc4_hvs *hvs,
struct vc4_hvs_dlist_allocation *alloc)
{
@@ -553,9 +565,7 @@ static void vc4_hvs_dlist_free_work(stru
if (!vc4_hvs_frcnt_lte(cur->target_frame_count, frcnt))
continue;
- list_del(&cur->node);
- drm_mm_remove_node(&cur->mm_node);
- kfree(cur);
+ vc4_hvs_free_dlist_entry_locked(hvs, cur);
}
spin_unlock_irqrestore(&hvs->mm_lock, flags);
}