git: 4befe500c045 - stable/15 - linuxkpi: Add 'fd_empty()`

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Tue, 22 Sep 2026 15:48:52 UTC
The branch stable/15 has been updated by wulf:

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

commit 4befe500c045408fa48fe4afd2053a10c53adb21
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2026-06-12 17:55:34 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2026-09-22 15:47:03 +0000

    linuxkpi: Add 'fd_empty()`
    
    The DRM drivers generic code started to use it in Linux 6.13.
    
    Reviewed by:    emaste
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D57582
    
    (cherry picked from commit 50aa145171bc88edde8cf3b7eb13dbbf88a3f8a7)
---
 sys/compat/linuxkpi/common/include/linux/file.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/file.h b/sys/compat/linuxkpi/common/include/linux/file.h
index 8a589bd2021b..6ed480f4356a 100644
--- a/sys/compat/linuxkpi/common/include/linux/file.h
+++ b/sys/compat/linuxkpi/common/include/linux/file.h
@@ -188,6 +188,12 @@ LINUXKPI_DEFINE_CLASS(fd, struct fd, fdput(_T), fdget(fd), int fd)
 
 #define	fd_file(fd)	((fd).linux_file)
 
+static inline bool
+fd_empty(struct fd fd)
+{
+	return (fd_file(fd) == NULL);
+}
+
 #define	file		linux_file
 #define	fget(...)	linux_fget(__VA_ARGS__)