git: e0eeeca8b83a - main - LinuxKPI: Add PTR_IF macro

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Mon, 08 Apr 2024 06:49:15 UTC
The branch main has been updated by wulf:

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

commit e0eeeca8b83a17aeebc4da525e813699bf3fabc2
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2024-04-08 06:47:42 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2024-04-08 06:47:42 +0000

    LinuxKPI: Add PTR_IF macro
    
    Sponsored by:   Serenity Cyber Security, LLC
    Reviewed by:    emaste
    MFC after:      1 week
---
 sys/compat/linuxkpi/common/include/linux/kernel.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h
index 16499ef96a50..ed4320e80fa7 100644
--- a/sys/compat/linuxkpi/common/include/linux/kernel.h
+++ b/sys/compat/linuxkpi/common/include/linux/kernel.h
@@ -132,6 +132,8 @@ extern int linuxkpi_warn_dump_stack;
 #define	printk(...)		printf(__VA_ARGS__)
 #define	vprintk(f, a)		vprintf(f, a)
 
+#define PTR_IF(x, p)		((x) ? (p) : NULL)
+
 #define	asm			__asm
 
 extern void linux_dump_stack(void);