git: b723bcd05a99 - main - linuxkpi: Add `list_for_each_prev_safe()` in <linux/list.h>

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Wed, 13 Dec 2023 18:28:46 UTC
The branch main has been updated by dumbbell:

URL: https://cgit.FreeBSD.org/src/commit/?id=b723bcd05a991d446491e914f2b9f35e66227398

commit b723bcd05a991d446491e914f2b9f35e66227398
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2023-12-08 21:53:21 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2023-12-13 18:18:46 +0000

    linuxkpi: Add `list_for_each_prev_safe()` in <linux/list.h>
    
    [Why]
    The amdgpu DRM driver started to use it in Linux 5.18.
    
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D43021
---
 sys/compat/linuxkpi/common/include/linux/list.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/list.h b/sys/compat/linuxkpi/common/include/linux/list.h
index a27abedc55b0..ca103a670109 100644
--- a/sys/compat/linuxkpi/common/include/linux/list.h
+++ b/sys/compat/linuxkpi/common/include/linux/list.h
@@ -225,6 +225,11 @@ list_del_init(struct list_head *entry)
 
 #define	list_for_each_prev(p, h) for (p = (h)->prev; p != (h); p = (p)->prev)
 
+#define	list_for_each_prev_safe(p, n, h) 				\
+	for (p = (h)->prev, n = (p)->prev;				\
+	     p != (h);							\
+	     p = n, n = (p)->prev)
+
 #define	list_for_each_entry_from_reverse(p, h, field)	\
 	for (; &p->field != (h);			\
 	     p = list_prev_entry(p, field))