This patch set aims to clean up the linux/kernel.h header and reduce
dependencies on it by moving parts out.
(These patches were part of my previous "fast kernel headers" pull
request which was found hard to review due to its huge size. I'm now
trying to resend smaller chunks of it, hoping they are easier to
review.)
Max Kellermann (8):
include/linux/goldfish.h: include linux/wordpart.h instead of
linux/kernel.h
include/drm/drm_fixed.h: include linux/wordpart.h instead of
linux/kernel.h
include linux/wordpart.h in various sources that need it
linux/random.h: reduce dependencies on linux/kernel.h
linux/kernel.h: move might_sleep(), ... to sched/debug_atomic_sleep.h
linux/kernel.h: move READ and WRITE to direction.h
linux/kernel.h: move VERIFY_OCTAL_PERMISSIONS() to octal_permissions.h
linux/kernel.h: move PTR_IF() to ptr_util.h
arch/arc/kernel/perf_event.c | 1 +
arch/arm64/include/asm/syscall.h | 1 +
arch/arm64/kvm/handle_exit.c | 1 +
drivers/bus/uniphier-system-bus.c | 1 +
drivers/edac/thunderx_edac.c | 1 +
drivers/gpio/gpio-sim.c | 1 +
drivers/gpu/drm/i915/i915_driver.c | 1 +
drivers/hwmon/occ/common.c | 1 +
drivers/input/misc/iqs7222.c | 1 +
drivers/irqchip/irq-gic-v3-its.c | 1 +
drivers/media/platform/amphion/vpu_dbg.c | 1 +
drivers/memstick/core/memstick.c | 1 +
drivers/memstick/host/jmb38x_ms.c | 1 +
drivers/memstick/host/r592.c | 1 +
drivers/memstick/host/rtsx_pci_ms.c | 1 +
drivers/memstick/host/rtsx_usb_ms.c | 1 +
drivers/memstick/host/tifm_ms.c | 1 +
drivers/pinctrl/pinctrl-ingenic.c | 1 +
drivers/soc/aspeed/aspeed-uart-routing.c | 1 +
drivers/spi/spi-pci1xxxx.c | 1 +
fs/ext4/super.c | 1 +
fs/hfs/hfs_fs.h | 1 +
fs/hfsplus/hfsplus_fs.h | 1 +
fs/notify/fanotify/fanotify_user.c | 1 +
fs/open.c | 1 +
fs/overlayfs/copy_up.c | 1 +
fs/ufs/util.h | 1 +
fs/xfs/xfs_error.c | 1 +
include/drm/drm_fixed.h | 2 +-
include/linux/clk.h | 1 +
include/linux/direction.h | 9 ++
include/linux/dma-fence.h | 1 +
include/linux/goldfish.h | 2 +-
include/linux/gpio/consumer.h | 2 +-
include/linux/kernel.h | 125 -----------------------
include/linux/mmu_notifier.h | 1 +
include/linux/moduleparam.h | 2 +-
include/linux/nd.h | 1 +
include/linux/octal_permissions.h | 20 ++++
include/linux/pm.h | 1 +
include/linux/ptr_util.h | 7 ++
include/linux/pwm.h | 2 +
include/linux/qed/common_hsi.h | 1 +
include/linux/random.h | 4 +-
include/linux/rcutiny.h | 1 +
include/linux/sched.h | 1 +
include/linux/sched/debug_atomic_sleep.h | 114 +++++++++++++++++++++
include/linux/sched/mm.h | 2 +-
include/linux/sysfs.h | 1 +
include/linux/uaccess.h | 1 +
include/linux/uio.h | 2 +-
include/linux/wait.h | 1 +
include/linux/wait_bit.h | 1 +
include/rdma/uverbs_ioctl.h | 3 +-
include/soc/fsl/bman.h | 2 +
include/soc/fsl/qman.h | 1 +
security/landlock/object.c | 1 +
security/landlock/ruleset.c | 1 +
58 files changed, 207 insertions(+), 134 deletions(-)
create mode 100644 include/linux/direction.h
create mode 100644 include/linux/octal_permissions.h
create mode 100644 include/linux/ptr_util.h
create mode 100644 include/linux/sched/debug_atomic_sleep.h
--
2.39.2
After commit edf2f6fb51bc ("kernel.h: Move upper_*_bits() and
lower_*_bits() to wordpart.h"), the lower/upper_*_bits functions can
be found in that header, and all sources that use those functions
should include the header that provides it.
This is just the beginning, many more sources are still missing, but a
large patch adding the "#include" everywhere (700+ sources) would be
hard to review.
(Found with "git grep -E '\b(upper|lower)_(16|32)_bits\('")
Signed-off-by: Max Kellermann <[email protected]>
---
arch/arm64/include/asm/syscall.h | 1 +
arch/arm64/kvm/handle_exit.c | 1 +
drivers/bus/uniphier-system-bus.c | 1 +
drivers/irqchip/irq-gic-v3-its.c | 1 +
drivers/spi/spi-pci1xxxx.c | 1 +
fs/ext4/super.c | 1 +
fs/hfs/hfs_fs.h | 1 +
fs/hfsplus/hfsplus_fs.h | 1 +
fs/notify/fanotify/fanotify_user.c | 1 +
fs/open.c | 1 +
fs/ufs/util.h | 1 +
include/linux/dma-fence.h | 1 +
include/linux/qed/common_hsi.h | 1 +
include/rdma/uverbs_ioctl.h | 2 +-
include/soc/fsl/bman.h | 2 ++
include/soc/fsl/qman.h | 1 +
16 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h
index ab8e14b96f68..e5f462cc1a54 100644
--- a/arch/arm64/include/asm/syscall.h
+++ b/arch/arm64/include/asm/syscall.h
@@ -8,6 +8,7 @@
#include <uapi/linux/audit.h>
#include <linux/compat.h>
#include <linux/err.h>
+#include <linux/wordpart.h> // for lower_32_bits()
typedef long (*syscall_fn_t)(const struct pt_regs *regs);
diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c
index 617ae6dea5d5..91bd5b701acf 100644
--- a/arch/arm64/kvm/handle_exit.c
+++ b/arch/arm64/kvm/handle_exit.c
@@ -10,6 +10,7 @@
#include <linux/kvm.h>
#include <linux/kvm_host.h>
+#include <linux/wordpart.h> // for lower_32_bits(), upper_32_bits()
#include <asm/esr.h>
#include <asm/exception.h>
diff --git a/drivers/bus/uniphier-system-bus.c b/drivers/bus/uniphier-system-bus.c
index cb5c89ce7b86..964f31287d3c 100644
--- a/drivers/bus/uniphier-system-bus.c
+++ b/drivers/bus/uniphier-system-bus.c
@@ -10,6 +10,7 @@
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
+#include <linux/wordpart.h> // for upper_32_bits()
/* System Bus Controller registers */
#define UNIPHIER_SBC_BASE 0x100 /* base address of bank0 space */
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 201055382bd1..94f917352ac6 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -29,6 +29,7 @@
#include <linux/percpu.h>
#include <linux/slab.h>
#include <linux/syscore_ops.h>
+#include <linux/wordpart.h> // for lower_32_bits(), upper_32_bits()
#include <linux/irqchip.h>
#include <linux/irqchip/arm-gic-v3.h>
diff --git a/drivers/spi/spi-pci1xxxx.c b/drivers/spi/spi-pci1xxxx.c
index 969965d7bc98..775673861c79 100644
--- a/drivers/spi/spi-pci1xxxx.c
+++ b/drivers/spi/spi-pci1xxxx.c
@@ -9,6 +9,7 @@
#include <linux/dma-mapping.h>
#include <linux/iopoll.h>
#include <linux/irq.h>
+#include <linux/kernel.h> // for upper_32_bits(), lower_32_bits()
#include <linux/module.h>
#include <linux/msi.h>
#include <linux/pci_regs.h>
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index e487623f9456..6a7686343bd0 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -48,6 +48,7 @@
#include <linux/fsnotify.h>
#include <linux/fs_context.h>
#include <linux/fs_parser.h>
+#include <linux/wordpart.h> // for lower_32_bits(), upper_32_bits()
#include "ext4.h"
#include "ext4_extents.h" /* Needed for trace points definition */
diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h
index b5a6ad5df357..514d3856aa27 100644
--- a/fs/hfs/hfs_fs.h
+++ b/fs/hfs/hfs_fs.h
@@ -20,6 +20,7 @@
#include <linux/mutex.h>
#include <linux/buffer_head.h>
#include <linux/fs.h>
+#include <linux/wordpart.h> // for lower_32_bits()
#include <linux/workqueue.h>
#include <asm/byteorder.h>
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index 7ededcb720c1..79cac82d050e 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -21,6 +21,7 @@
#include <linux/mutex.h>
#include <linux/buffer_head.h>
#include <linux/blkdev.h>
+#include <linux/wordpart.h> // for lower_32_bits()
#include "hfsplus_raw.h"
#define DBG_BNODE_REFS 0x00000001
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index fbdc63cc10d9..9ca5adbf39ae 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -20,6 +20,7 @@
#include <linux/memcontrol.h>
#include <linux/statfs.h>
#include <linux/exportfs.h>
+#include <linux/wordpart.h> // for upper_32_bits()
#include <asm/ioctls.h>
diff --git a/fs/open.c b/fs/open.c
index a7d4bb2c725f..b006de16a15a 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -34,6 +34,7 @@
#include <linux/compat.h>
#include <linux/mnt_idmapping.h>
#include <linux/filelock.h>
+#include <linux/wordpart.h> // for upper_32_bits()
#include "internal.h"
diff --git a/fs/ufs/util.h b/fs/ufs/util.h
index 0ecd2ed792f5..0d4b89794cc5 100644
--- a/fs/ufs/util.h
+++ b/fs/ufs/util.h
@@ -9,6 +9,7 @@
#include <linux/buffer_head.h>
#include <linux/fs.h>
+#include <linux/wordpart.h> // for lower_32_bits()
#include "swab.h"
/*
diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index e06bad467f55..02ad83247ea8 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -22,6 +22,7 @@
#include <linux/printk.h>
#include <linux/rcupdate.h>
#include <linux/timekeeping.h>
+#include <linux/wordpart.h> // for lower_32_bits()
struct dma_fence;
struct dma_fence_ops;
diff --git a/include/linux/qed/common_hsi.h b/include/linux/qed/common_hsi.h
index 827624840ee2..fa9cc2be077f 100644
--- a/include/linux/qed/common_hsi.h
+++ b/include/linux/qed/common_hsi.h
@@ -11,6 +11,7 @@
#include <asm/byteorder.h>
#include <linux/bitops.h>
#include <linux/slab.h>
+#include <linux/wordpart.h> // for lower_32_bits(), upper_32_bits()
/* dma_addr_t manip */
#define PTR_LO(x) ((u32)(((uintptr_t)(x)) & 0xffffffff))
diff --git a/include/rdma/uverbs_ioctl.h b/include/rdma/uverbs_ioctl.h
index 06287de69cd2..5ed57a660ead 100644
--- a/include/rdma/uverbs_ioctl.h
+++ b/include/rdma/uverbs_ioctl.h
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
-/*
+ /*
* Copyright (c) 2017, Mellanox Technologies inc. All rights reserved.
*/
diff --git a/include/soc/fsl/bman.h b/include/soc/fsl/bman.h
index 173e4049d963..b01d8c0ac204 100644
--- a/include/soc/fsl/bman.h
+++ b/include/soc/fsl/bman.h
@@ -31,6 +31,8 @@
#ifndef __FSL_BMAN_H
#define __FSL_BMAN_H
+#include <linux/wordpart.h> // for upper_32_bits()
+
/* wrapper for 48-bit buffers */
struct bm_buffer {
union {
diff --git a/include/soc/fsl/qman.h b/include/soc/fsl/qman.h
index 0d3d6beb7fdb..c5230a844114 100644
--- a/include/soc/fsl/qman.h
+++ b/include/soc/fsl/qman.h
@@ -33,6 +33,7 @@
#include <linux/bitops.h>
#include <linux/device.h>
+#include <linux/wordpart.h> // for upper_32_bits()
/* Hardware constants */
#define QM_CHANNEL_SWPORTAL0 0
--
2.39.2