All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: encourage BIT() macro usage in register definitions
@ 2018-06-27 14:41 Jani Nikula
  2018-06-27 15:51 ` Michal Wajdeczko
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Jani Nikula @ 2018-06-27 14:41 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula, Paulo Zanoni

There's already some BIT() usage here and there, embrace it.

Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/i915_reg.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 476118f46cf3..64b9c270045d 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -65,9 +65,10 @@
  * but do note that the macros may be needed to read as well as write the
  * register contents.
  *
- * Define bits using ``(1 << N)`` instead of ``BIT(N)``. We may change this in
- * the future, but this is the prevailing style. Do **not** add ``_BIT`` suffix
- * to the name.
+ * Define bits using ``BIT(N)`` instead of ``(1 << N)``. Do **not** add ``_BIT``
+ * suffix to the name. Exception to ``BIT()`` usage: Value 1 for a bit field
+ * should be defined using ``(1 << N)`` to be in line with other values such as
+ * ``(2 << N)`` for the same field.
  *
  * Group the register and its contents together without blank lines, separate
  * from other registers and their contents with one blank line.
@@ -105,7 +106,7 @@
  *  #define _FOO_A                      0xf000
  *  #define _FOO_B                      0xf001
  *  #define FOO(pipe)                   _MMIO_PIPE(pipe, _FOO_A, _FOO_B)
- *  #define   FOO_ENABLE                (1 << 31)
+ *  #define   FOO_ENABLE                BIT(31)
  *  #define   FOO_MODE_MASK             (0xf << 16)
  *  #define   FOO_MODE_SHIFT            16
  *  #define   FOO_MODE_BAR              (0 << 16)
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-06-28 19:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-27 14:41 [PATCH] drm/i915: encourage BIT() macro usage in register definitions Jani Nikula
2018-06-27 15:51 ` Michal Wajdeczko
2018-06-27 15:59   ` Chris Wilson
2018-06-28 12:03     ` Jani Nikula
2018-06-28 17:45       ` Paulo Zanoni
2018-06-28 19:05         ` Rodrigo Vivi
2018-06-27 17:25 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-06-27 20:07 ` ✓ Fi.CI.IGT: " Patchwork
2018-06-28  4:57 ` [PATCH] " Rodrigo Vivi

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.