mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Denis Orlov <denorl2009@gmail.com>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>,
	Denis Orlov <denorl2009@gmail.com>
Subject: [PATCH 1/3] include: const: make UL/ULL() macros commonly available
Date: Fri,  9 Jun 2023 07:54:07 +0300	[thread overview]
Message-ID: <20230609045829.2225-2-denorl2009@gmail.com> (raw)
In-Reply-To: <20230609045829.2225-1-denorl2009@gmail.com>

Import the definitions from Linux. Some code actually used those
already, defining them locally. As these are not needed now that there
are common ones available, remove the duplicate definitions.

While at it, also update _BITUL/_BITULL() definitions to align more with
the latest Linux sources.

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 arch/arm/include/asm/memory.h    |  5 -----
 arch/arm/include/asm/pgtable64.h |  2 --
 arch/kvx/include/asm/sfr_defs.h  |  2 --
 include/linux/const.h            | 10 ++++++++--
 4 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 2b454fa673..23fbbd8438 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -6,11 +6,6 @@
 #include <memory.h>
 
 #include <linux/const.h>
-/*
- * Allow for constants defined here to be used from assembly code
- * by prepending the UL suffix only with actual C code compilation.
- */
-#define UL(x) _AC(x, UL)
 
 static inline int arm_add_mem_device(const char* name, resource_size_t start,
 				     resource_size_t size)
diff --git a/arch/arm/include/asm/pgtable64.h b/arch/arm/include/asm/pgtable64.h
index dbec61753b..21dac30cfe 100644
--- a/arch/arm/include/asm/pgtable64.h
+++ b/arch/arm/include/asm/pgtable64.h
@@ -4,8 +4,6 @@
 #ifndef __ASM_PGTABLE64_H
 #define __ASM_PGTABLE64_H
 
-#define UL(x)		_AC(x, UL)
-
 #define UNUSED_DESC                0x6EbAAD0BBADbA6E0
 
 #define VA_START                   0x0
diff --git a/arch/kvx/include/asm/sfr_defs.h b/arch/kvx/include/asm/sfr_defs.h
index 2b7598e0aa..7f6fbd206b 100644
--- a/arch/kvx/include/asm/sfr_defs.h
+++ b/arch/kvx/include/asm/sfr_defs.h
@@ -8,8 +8,6 @@
 
 #include <linux/const.h>
 
-#define _ULL(X) _AC(X, ULL)
-
 /* Register file indices */
 #define KVX_SFR_PC 0 /* Program Counter $pc $s0 */
 #define KVX_SFR_PS 1 /* Processor State $ps $s1 */
diff --git a/include/linux/const.h b/include/linux/const.h
index 07f886d271..07414f95de 100644
--- a/include/linux/const.h
+++ b/include/linux/const.h
@@ -23,7 +23,13 @@
 #define _AT(T,X)	((T)(X))
 #endif
 
-#define _BITUL(x)	(_AC(1,UL) << (x))
-#define _BITULL(x)	(_AC(1,ULL) << (x))
+#define _UL(x)		(_AC(x, UL))
+#define _ULL(x)		(_AC(x, ULL))
+
+#define _BITUL(x)	(_UL(1) << (x))
+#define _BITULL(x)	(_ULL(1) << (x))
+
+#define UL(x)		(_UL(x))
+#define ULL(x)		(_ULL(x))
 
 #endif /* !(_LINUX_CONST_H) */
-- 
2.41.0




  reply	other threads:[~2023-06-09  5:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09  4:54 [PATCH 0/3] include: bitops/const: partial update from Linux Denis Orlov
2023-06-09  4:54 ` Denis Orlov [this message]
2023-06-09  4:54 ` [PATCH 2/3] include: bitops: allow BIT* macros to be used in assembly code Denis Orlov
2023-06-09  4:54 ` [PATCH 3/3] include: bitops: import more BITS_TO_* defines from linux Denis Orlov
2023-06-09  6:30 ` [PATCH 0/3] include: bitops/const: partial update from Linux Sascha Hauer

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=20230609045829.2225-2-denorl2009@gmail.com \
    --to=denorl2009@gmail.com \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.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