From: Max Kellermann <max.kellermann@ionos.com>
To: linux-kernel@vger.kernel.org
Cc: Max Kellermann <max.kellermann@ionos.com>
Subject: [PATCH v1 8/8] linux/kernel.h: move PTR_IF() to ptr_util.h
Date: Thu, 15 Feb 2024 10:36:46 +0100 [thread overview]
Message-ID: <20240215093646.3265823-9-max.kellermann@ionos.com> (raw)
In-Reply-To: <20240215093646.3265823-1-max.kellermann@ionos.com>
Reducing dependencies on the header linux/kernel.h.
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
---
drivers/gpio/gpio-sim.c | 1 +
drivers/gpu/drm/i915/i915_driver.c | 1 +
drivers/pinctrl/pinctrl-ingenic.c | 1 +
include/linux/kernel.h | 2 --
include/linux/pm.h | 1 +
include/linux/ptr_util.h | 7 +++++++
include/rdma/uverbs_ioctl.h | 1 +
7 files changed, 12 insertions(+), 2 deletions(-)
create mode 100644 include/linux/ptr_util.h
diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
index c4106e37e6db..fdf17cc91b4c 100644
--- a/drivers/gpio/gpio-sim.c
+++ b/drivers/gpio/gpio-sim.c
@@ -29,6 +29,7 @@
#include <linux/notifier.h>
#include <linux/platform_device.h>
#include <linux/property.h>
+#include <linux/ptr_util.h> // for PTR_IF()
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/string.h>
diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
index 9ee902d5b72c..6dd0d8fdd6eb 100644
--- a/drivers/gpu/drm/i915/i915_driver.c
+++ b/drivers/gpu/drm/i915/i915_driver.c
@@ -34,6 +34,7 @@
#include <linux/pci.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
+#include <linux/ptr_util.h> // for PTR_IF()
#include <linux/slab.h>
#include <linux/string_helpers.h>
#include <linux/vga_switcheroo.h>
diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
index bc6358a686fc..f88d2d3d217c 100644
--- a/drivers/pinctrl/pinctrl-ingenic.c
+++ b/drivers/pinctrl/pinctrl-ingenic.c
@@ -16,6 +16,7 @@
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/property.h>
+#include <linux/ptr_util.h> // for PTR_IF()
#include <linux/regmap.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 01a0cc0a0776..1f1b2ced524f 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -40,8 +40,6 @@
#define STACK_MAGIC 0xdeadbeef
-#define PTR_IF(cond, ptr) ((cond) ? (ptr) : NULL)
-
#define u64_to_user_ptr(x) ( \
{ \
typecheck(u64, (x)); \
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 97b0e23363c8..7e593b5fc5f1 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -9,6 +9,7 @@
#define _LINUX_PM_H
#include <linux/export.h>
+#include <linux/ptr_util.h> // for PTR_IF()
#include <linux/list.h>
#include <linux/workqueue.h>
#include <linux/spinlock.h>
diff --git a/include/linux/ptr_util.h b/include/linux/ptr_util.h
new file mode 100644
index 000000000000..7469aff978a9
--- /dev/null
+++ b/include/linux/ptr_util.h
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_PTR_UTIL_H
+#define _LINUX_PTR_UTIL_H
+
+#define PTR_IF(cond, ptr) ((cond) ? (ptr) : NULL)
+
+#endif /* _LINUX_PTR_UTIL_H */
diff --git a/include/rdma/uverbs_ioctl.h b/include/rdma/uverbs_ioctl.h
index 5ed57a660ead..c94244e7a77d 100644
--- a/include/rdma/uverbs_ioctl.h
+++ b/include/rdma/uverbs_ioctl.h
@@ -7,6 +7,7 @@
#define _UVERBS_IOCTL_
#include <rdma/uverbs_types.h>
+#include <linux/ptr_util.h> // for PTR_IF()
#include <linux/uaccess.h>
#include <rdma/rdma_user_ioctl.h>
#include <rdma/ib_user_ioctl_verbs.h>
--
2.39.2
prev parent reply other threads:[~2024-02-15 9:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-15 9:36 [PATCH v1 0/8] Fast kernel headers: split linux/kernel.h Max Kellermann
2024-02-15 9:36 ` [PATCH v1 1/8] include/linux/goldfish.h: include linux/wordpart.h instead of linux/kernel.h Max Kellermann
2024-02-15 9:36 ` [PATCH v1 2/8] include/drm/drm_fixed.h: " Max Kellermann
2024-02-15 9:36 ` [PATCH v1 3/8] include linux/wordpart.h in various sources that need it Max Kellermann
2024-02-15 9:36 ` [PATCH v1 4/8] linux/random.h: reduce dependencies on linux/kernel.h Max Kellermann
2024-02-15 9:36 ` [PATCH v1 5/8] linux/kernel.h: move might_sleep(), ... to sched/debug_atomic_sleep.h Max Kellermann
2024-02-15 9:36 ` [PATCH v1 6/8] linux/kernel.h: move READ and WRITE to direction.h Max Kellermann
2024-02-15 9:36 ` [PATCH v1 7/8] linux/kernel.h: move VERIFY_OCTAL_PERMISSIONS() to octal_permissions.h Max Kellermann
2024-02-15 9:36 ` Max Kellermann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240215093646.3265823-9-max.kellermann@ionos.com \
--to=max.kellermann@ionos.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox