dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org
Cc: "Masahiro Yamada" <masahiroy@kernel.org>,
	"Kevin Brodsky" <kevin.brodsky@arm.com>,
	"Lucas De Marchi" <lucas.demarchi@intel.com>,
	linux-kernel@vger.kernel.org,
	"Christian König" <christian.koenig@amd.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Andrew Morton" <akpm@linux-foundation.org>
Subject: [PATCH 3/3] drm/i915: Temporary conversion to new GENMASK/BIT macros
Date: Mon,  8 May 2023 22:14:03 -0700	[thread overview]
Message-ID: <20230509051403.2748545-4-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20230509051403.2748545-1-lucas.demarchi@intel.com>

Convert the REG_* macros from i915_reg_defs.h to use the new macros
defined in linux/bits.h. This is just to help on the implementation
of the new macros and not intended to be applied.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/i915/i915_reg_defs.h | 28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg_defs.h b/drivers/gpu/drm/i915/i915_reg_defs.h
index 622d603080f9..61fbb8d62b25 100644
--- a/drivers/gpu/drm/i915/i915_reg_defs.h
+++ b/drivers/gpu/drm/i915/i915_reg_defs.h
@@ -17,10 +17,7 @@
  *
  * @return: Value with bit @__n set.
  */
-#define REG_BIT(__n)							\
-	((u32)(BIT(__n) +						\
-	       BUILD_BUG_ON_ZERO(__is_constexpr(__n) &&		\
-				 ((__n) < 0 || (__n) > 31))))
+#define REG_BIT(__n) BIT_U32(__n)
 
 /**
  * REG_BIT8() - Prepare a u8 bit value
@@ -30,10 +27,7 @@
  *
  * @return: Value with bit @__n set.
  */
-#define REG_BIT8(__n)                                                   \
-	((u8)(BIT(__n) +                                                \
-	       BUILD_BUG_ON_ZERO(__is_constexpr(__n) &&         \
-				 ((__n) < 0 || (__n) > 7))))
+#define REG_BIT8(__n) BIT_U8(__n)
 
 /**
  * REG_GENMASK() - Prepare a continuous u32 bitmask
@@ -44,11 +38,7 @@
  *
  * @return: Continuous bitmask from @__high to @__low, inclusive.
  */
-#define REG_GENMASK(__high, __low)					\
-	((u32)(GENMASK(__high, __low) +					\
-	       BUILD_BUG_ON_ZERO(__is_constexpr(__high) &&	\
-				 __is_constexpr(__low) &&		\
-				 ((__low) < 0 || (__high) > 31 || (__low) > (__high)))))
+#define REG_GENMASK(__high, __low) GENMASK_U32(__high, __low)
 
 /**
  * REG_GENMASK64() - Prepare a continuous u64 bitmask
@@ -59,11 +49,7 @@
  *
  * @return: Continuous bitmask from @__high to @__low, inclusive.
  */
-#define REG_GENMASK64(__high, __low)					\
-	((u64)(GENMASK_ULL(__high, __low) +				\
-	       BUILD_BUG_ON_ZERO(__is_constexpr(__high) &&		\
-				 __is_constexpr(__low) &&		\
-				 ((__low) < 0 || (__high) > 63 || (__low) > (__high)))))
+#define REG_GENMASK64(__high, __low) GENMASK_ULL(__high, __low)
 
 /**
  * REG_GENMASK8() - Prepare a continuous u8 bitmask
@@ -74,11 +60,7 @@
  *
  * @return: Continuous bitmask from @__high to @__low, inclusive.
  */
-#define REG_GENMASK8(__high, __low)                                     \
-	((u8)(GENMASK(__high, __low) +                                  \
-	       BUILD_BUG_ON_ZERO(__is_constexpr(__high) &&      \
-				 __is_constexpr(__low) &&               \
-				 ((__low) < 0 || (__high) > 7 || (__low) > (__high)))))
+#define REG_GENMASK8(__high, __low) GENMASK_U8(__high, __low)
 
 /*
  * Local integer constant expression version of is_power_of_2().
-- 
2.40.1


  parent reply	other threads:[~2023-05-09  5:15 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-09  5:14 [PATCH 0/3] Fixed-width mask/bit helpers Lucas De Marchi
2023-05-09  5:14 ` [PATCH 1/3] drm/amd: Remove wrapper macros over get_u{32,16,8} Lucas De Marchi
2023-05-09  5:14 ` [PATCH 2/3] linux/bits.h: Add fixed-width GENMASK and BIT macros Lucas De Marchi
2023-05-09 14:00   ` [Intel-xe] " Gustavo Sousa
2023-05-09 21:34     ` Lucas De Marchi
2023-05-10 12:18   ` kernel test robot
2023-05-12 11:14   ` Andy Shevchenko
2023-05-12 11:25     ` Jani Nikula
2023-05-12 11:32       ` Andy Shevchenko
2023-05-12 11:45         ` Jani Nikula
2023-06-15 15:53           ` Andy Shevchenko
2023-06-20 14:47             ` Jani Nikula
2023-06-20 14:55               ` Andy Shevchenko
2023-06-20 17:25                 ` [Intel-xe] " Lucas De Marchi
2023-06-20 17:41                   ` Andy Shevchenko
2023-06-20 18:02                     ` Lucas De Marchi
2023-06-20 18:19                     ` Jani Nikula
2023-05-12 16:29     ` Lucas De Marchi
2023-06-15 15:58       ` Andy Shevchenko
2023-06-22  2:20   ` Yury Norov
2023-06-22  6:15     ` Lucas De Marchi
2023-06-22 14:59       ` Yury Norov
2024-01-18 20:42     ` Re: [Intel-xe] " Lucas De Marchi
2024-01-18 21:48       ` Yury Norov
2024-01-18 23:25         ` Lucas De Marchi
2024-01-19  2:01           ` Yury Norov
2024-01-19 15:07             ` Lucas De Marchi
2023-05-09  5:14 ` Lucas De Marchi [this message]
2023-05-09  7:57   ` [PATCH 3/3] drm/i915: Temporary conversion to new GENMASK/BIT macros Jani Nikula
2023-05-09  8:15     ` Lucas De Marchi

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=20230509051403.2748545-4-lucas.demarchi@intel.com \
    --to=lucas.demarchi@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.deucher@amd.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=kevin.brodsky@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).