All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Kellermann <max.kellermann@ionos.com>
To: linux-kernel@vger.kernel.org
Cc: Max Kellermann <max.kellermann@ionos.com>
Subject: [PATCH v4 33/35] linux/kernel.h: move upper/lower_*_bits macros to wordpart.h
Date: Mon, 12 Feb 2024 00:15:16 +0100	[thread overview]
Message-ID: <20240211231518.349442-34-max.kellermann@ionos.com> (raw)
In-Reply-To: <20240211231518.349442-1-max.kellermann@ionos.com>

Reducing dependencies on the header linux/kernel.h.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
---
 arch/arm64/include/asm/syscall.h  |  2 +-
 arch/arm64/kvm/handle_exit.c      |  2 +-
 drivers/bus/uniphier-system-bus.c |  2 +-
 drivers/irqchip/irq-gic-v3-its.c  |  1 +
 drivers/spi/spi-pci1xxxx.c        |  1 +
 fs/hfs/hfs_fs.h                   |  2 +-
 fs/hfsplus/hfsplus_fs.h           |  2 +-
 include/drm/drm_fixed.h           |  2 +-
 include/linux/dma-fence.h         |  2 +-
 include/linux/goldfish.h          |  2 +-
 include/linux/kernel.h            | 29 +----------------------------
 include/linux/qed/common_hsi.h    |  1 +
 include/linux/wordpart.h          | 28 ++++++++++++++++++++++++++++
 include/rdma/uverbs_ioctl.h       |  2 +-
 include/soc/fsl/bman.h            |  2 ++
 include/soc/fsl/qman.h            |  1 +
 16 files changed, 44 insertions(+), 37 deletions(-)

diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h
index 107ada608694..e5f462cc1a54 100644
--- a/arch/arm64/include/asm/syscall.h
+++ b/arch/arm64/include/asm/syscall.h
@@ -8,7 +8,7 @@
 #include <uapi/linux/audit.h>
 #include <linux/compat.h>
 #include <linux/err.h>
-#include <linux/kernel.h> // for lower_32_bits()
+#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 a82b4b31bb36..91bd5b701acf 100644
--- a/arch/arm64/kvm/handle_exit.c
+++ b/arch/arm64/kvm/handle_exit.c
@@ -10,7 +10,7 @@
 
 #include <linux/kvm.h>
 #include <linux/kvm_host.h>
-#include <linux/kernel.h> // for upper_32_bits(), lower_32_bits()
+#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 8cffdb089a6b..8949a7a5c170 100644
--- a/drivers/bus/uniphier-system-bus.c
+++ b/drivers/bus/uniphier-system-bus.c
@@ -6,7 +6,7 @@
 #include <linux/io.h>
 #include <linux/kernel.h> // for upper_32_bits(), lower_32_bits()
 #include <linux/log2.h>
-#include <linux/kernel.h> // for upper_32_bits()
+#include <linux/wordpart.h> // for upper_32_bits()
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 1be09abac7cc..2b33edb78c26 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -30,6 +30,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 ab99aac85eb9..1ff89d726927 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/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h
index 71ebbed52f5f..99e54ff4df83 100644
--- a/fs/hfs/hfs_fs.h
+++ b/fs/hfs/hfs_fs.h
@@ -17,7 +17,7 @@
 
 #include <linux/slab.h>
 #include <linux/types.h>
-#include <linux/kernel.h> // for lower_32_bits()
+#include <linux/wordpart.h> // for lower_32_bits()
 #include <linux/mutex.h>
 #include <linux/buffer_head.h>
 #include <linux/fs.h>
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index 157dad01495f..79cac82d050e 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -21,7 +21,7 @@
 #include <linux/mutex.h>
 #include <linux/buffer_head.h>
 #include <linux/blkdev.h>
-#include <linux/kernel.h> // for lower_32_bits()
+#include <linux/wordpart.h> // for lower_32_bits()
 #include "hfsplus_raw.h"
 
 #define DBG_BNODE_REFS	0x00000001
diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h
index 0c9f917a4d4b..ff9a91fa40b6 100644
--- a/include/drm/drm_fixed.h
+++ b/include/drm/drm_fixed.h
@@ -25,7 +25,7 @@
 #ifndef DRM_FIXED_H
 #define DRM_FIXED_H
 
-#include <linux/kernel.h>
+#include <linux/wordpart.h> // for lower_32_bits()
 #include <linux/math64.h>
 
 typedef union dfixed {
diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index 3081ff146d41..308d77098e21 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -16,7 +16,7 @@
 #include <linux/err.h>
 #include <linux/list.h>
 #include <linux/bitops.h>
-#include <linux/kernel.h> // for lower_32_bits()
+#include <linux/wordpart.h> // for lower_32_bits()
 #include <linux/kref.h>
 #include <linux/sched.h>
 #include <linux/printk.h>
diff --git a/include/linux/goldfish.h b/include/linux/goldfish.h
index bcc17f95b906..8b2b3046f779 100644
--- a/include/linux/goldfish.h
+++ b/include/linux/goldfish.h
@@ -2,7 +2,7 @@
 #ifndef __LINUX_GOLDFISH_H
 #define __LINUX_GOLDFISH_H
 
-#include <linux/kernel.h>
+#include <linux/wordpart.h> // for lower_32_bits(), upper_32_bits()
 #include <linux/types.h>
 #include <linux/io.h>
 
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index ac332f4deed9..6f436367dd16 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -32,6 +32,7 @@
 #include <linux/sprintf.h>
 #include <linux/static_call_types.h>
 #include <linux/instruction_pointer.h>
+#include <linux/wordpart.h>
 #include <asm/byteorder.h>
 
 #include <uapi/linux/kernel.h>
@@ -47,34 +48,6 @@
 }					\
 )
 
-/**
- * upper_32_bits - return bits 32-63 of a number
- * @n: the number we're accessing
- *
- * A basic shift-right of a 64- or 32-bit quantity.  Use this to suppress
- * the "right shift count >= width of type" warning when that quantity is
- * 32-bits.
- */
-#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
-
-/**
- * lower_32_bits - return bits 0-31 of a number
- * @n: the number we're accessing
- */
-#define lower_32_bits(n) ((u32)((n) & 0xffffffff))
-
-/**
- * upper_16_bits - return bits 16-31 of a number
- * @n: the number we're accessing
- */
-#define upper_16_bits(n) ((u16)((n) >> 16))
-
-/**
- * lower_16_bits - return bits 0-15 of a number
- * @n: the number we're accessing
- */
-#define lower_16_bits(n) ((u16)((n) & 0xffff))
-
 void do_exit(long error_code) __noreturn;
 
 extern int get_option(char **str, int *pint);
diff --git a/include/linux/qed/common_hsi.h b/include/linux/qed/common_hsi.h
index 827624840ee2..11482394d7f3 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 upper_32_bits()
 
 /* dma_addr_t manip */
 #define PTR_LO(x)		((u32)(((uintptr_t)(x)) & 0xffffffff))
diff --git a/include/linux/wordpart.h b/include/linux/wordpart.h
index c9e6bd773ebd..a73f0c84a03a 100644
--- a/include/linux/wordpart.h
+++ b/include/linux/wordpart.h
@@ -10,4 +10,32 @@
  */
 #define REPEAT_BYTE(x)	((~0ul / 0xff) * (x))
 
+/**
+ * upper_32_bits - return bits 32-63 of a number
+ * @n: the number we're accessing
+ *
+ * A basic shift-right of a 64- or 32-bit quantity.  Use this to suppress
+ * the "right shift count >= width of type" warning when that quantity is
+ * 32-bits.
+ */
+#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
+
+/**
+ * lower_32_bits - return bits 0-31 of a number
+ * @n: the number we're accessing
+ */
+#define lower_32_bits(n) ((u32)((n) & 0xffffffff))
+
+/**
+ * upper_16_bits - return bits 16-31 of a number
+ * @n: the number we're accessing
+ */
+#define upper_16_bits(n) ((u16)((n) >> 16))
+
+/**
+ * lower_16_bits - return bits 0-15 of a number
+ * @n: the number we're accessing
+ */
+#define lower_16_bits(n) ((u16)((n) & 0xffff))
+
 #endif // _LINUX_WORDPART_H
diff --git a/include/rdma/uverbs_ioctl.h b/include/rdma/uverbs_ioctl.h
index 47a6be467004..05002792b078 100644
--- a/include/rdma/uverbs_ioctl.h
+++ b/include/rdma/uverbs_ioctl.h
@@ -7,7 +7,7 @@
 #define _UVERBS_IOCTL_
 
 #include <rdma/uverbs_types.h>
-#include <linux/kernel.h> // for upper_32_bits(), lower_32_bits()
+#include <linux/wordpart.h>
 #include <linux/uaccess.h>
 #include <rdma/rdma_user_ioctl.h>
 #include <rdma/ib_user_ioctl_verbs.h>
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


  parent reply	other threads:[~2024-02-11 23:16 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-11 23:14 [PATCH v4 00/35] Fast kernel headers: reduce header dependencies Max Kellermann
2024-02-11 23:14 ` [PATCH v4 01/35] include: add missing includes Max Kellermann
2024-02-11 23:14 ` [PATCH v4 02/35] include: remove unnecessary #include directives Max Kellermann
2024-02-12  9:15   ` kernel test robot
2024-02-12 12:41   ` kernel test robot
2024-02-11 23:14 ` [PATCH v4 03/35] include: reduce header dependencies by using "*_types.h" Max Kellermann
2024-02-12  4:15   ` kernel test robot
2024-02-12  5:18   ` kernel test robot
2024-02-12  5:18   ` kernel test robot
2024-02-11 23:14 ` [PATCH v4 04/35] workqueue.h: move struct delayed_work to workqueue_types.h Max Kellermann
2024-02-11 23:14 ` [PATCH v4 05/35] kref.h: move declarations to kref_types.h Max Kellermann
2024-02-11 23:14 ` [PATCH v4 06/35] kobject.h: move declarations to kobject_types.h Max Kellermann
2024-02-11 23:14 ` [PATCH v4 07/35] sysfs.h: move declarations to sysfs_types.h Max Kellermann
2024-02-11 23:14 ` [PATCH v4 08/35] maple_tree.h: move declarations to maple_tree_types.h Max Kellermann
2024-02-11 23:14 ` [PATCH v4 09/35] rwsem.h: move declarations to rwsem_types.h Max Kellermann
2024-02-11 23:14 ` [PATCH v4 10/35] uprobes.h: move declarations to uprobes_types.h Max Kellermann
2024-02-11 23:14 ` [PATCH v4 11/35] percpu_counter.h: move declarations to percpu_counter_types.h Max Kellermann
2024-02-11 23:14 ` [PATCH v4 12/35] bvec.h: move declarations to bvec_types.h Max Kellermann
2024-02-11 23:14 ` [PATCH v4 13/35] wait.h: move declarations to wait_types.h Max Kellermann
2024-02-11 23:14 ` [PATCH v4 14/35] swait.h: move declarations to swait_types.h Max Kellermann
2024-02-11 23:14 ` [PATCH v4 15/35] completion.h: move declarations to completion_types.h Max Kellermann
2024-02-11 23:14 ` [PATCH v4 16/35] device.h: move declarations to device_types.h Max Kellermann
2024-02-11 23:15 ` [PATCH v4 17/35] xarray.h: move declarations to xarray_types.h Max Kellermann
2024-02-11 23:15 ` [PATCH v4 18/35] blkdev.h: move blk_op_is_passthrough() to blk_types.h Max Kellermann
2024-02-11 23:15 ` [PATCH v4 19/35] bio.h: move bio_has_data() and bio_no_advance_iter() " Max Kellermann
2024-02-11 23:15 ` [PATCH v4 20/35] bio.h: move declarations to bio_types.h Max Kellermann
2024-02-11 23:15 ` [PATCH v4 21/35] percpu-refcount.h: move declarations to percpu-refcount_types.h Max Kellermann
2024-02-11 23:15 ` [PATCH v4 22/35] blkdev.h: move declarations to blkdev_types.h Max Kellermann
2024-02-11 23:15 ` [PATCH v4 23/35] sbitmap.h: move declarations to sbitmap_types.h Max Kellermann
2024-02-11 23:15 ` [PATCH v4 24/35] list_lru.h: move declarations to list_lru_types.h Max Kellermann
2024-02-11 23:15 ` [PATCH v4 25/35] list_bl.h: move declarations to list_bl_types.h Max Kellermann
2024-02-11 23:15 ` [PATCH v4 26/35] percpu-rwsem.h: move declarations to percpu-rwsem_types.h Max Kellermann
2024-02-11 23:15 ` [PATCH v4 27/35] quota.h: move declarations to quota_types.h Max Kellermann
2024-02-11 23:15 ` [PATCH v4 28/35] radix-tree.h: move declarations to radix-tree_types.h Max Kellermann
2024-02-11 23:15 ` [PATCH v4 29/35] linux/random.h: reduce dependencies on linux/kernel.h Max Kellermann
2024-02-11 23:15 ` [PATCH v4 30/35] linux/kernel.h: move might_sleep(), ... to sched/debug_atomic_sleep.h Max Kellermann
2024-02-11 23:15 ` [PATCH v4 31/35] linux/kernel.h: move READ and WRITE to direction.h Max Kellermann
2024-02-11 23:15 ` [PATCH v4 32/35] linux/kernel.h: move VERIFY_OCTAL_PERMISSIONS() to octal_permissions.h Max Kellermann
2024-02-11 23:15 ` Max Kellermann [this message]
2024-02-11 23:15 ` [PATCH v4 34/35] linux/kernel.h: move PTR_IF() to ptr_util.h Max Kellermann
2024-02-11 23:15 ` [PATCH v4 35/35] include: remove lots of unnecessary <linux/kernel.h> includes Max Kellermann
2024-02-12 13:43 ` [PATCH v4 00/35] Fast kernel headers: reduce header dependencies Jason Gunthorpe

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=20240211231518.349442-34-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.