[09/13] nvdimm: btt.h: Neaten #defines to improve readability
diff mbox series

Message ID d1815f376a158c940cc9f9f6d5000398ba531237.1568256708.git.joe@perches.com
State New
Headers show
Series
  • nvdimm: Use more common kernel coding style
Related show

Commit Message

Joe Perches Sept. 12, 2019, 2:54 a.m. UTC
Use tab alignment to make the content and macro a bit more intelligible.

Use the BIT and BIT_ULL macros.
Convert MAP_LBA_MASK to use the already defined shift masks.

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/nvdimm/btt.h | 54 ++++++++++++++++++++++++++--------------------------
 1 file changed, 27 insertions(+), 27 deletions(-)

Patch
diff mbox series

diff --git a/drivers/nvdimm/btt.h b/drivers/nvdimm/btt.h
index 1da76da3e159..fb0f4546153f 100644
--- a/drivers/nvdimm/btt.h
+++ b/drivers/nvdimm/btt.h
@@ -10,34 +10,34 @@ 
 #include <linux/badblocks.h>
 #include <linux/types.h>
 
-#define BTT_SIG_LEN 16
-#define BTT_SIG "BTT_ARENA_INFO\0"
-#define MAP_ENT_SIZE 4
-#define MAP_TRIM_SHIFT 31
-#define MAP_TRIM_MASK (1 << MAP_TRIM_SHIFT)
-#define MAP_ERR_SHIFT 30
-#define MAP_ERR_MASK (1 << MAP_ERR_SHIFT)
-#define MAP_LBA_MASK (~((1 << MAP_TRIM_SHIFT) | (1 << MAP_ERR_SHIFT)))
-#define MAP_ENT_NORMAL 0xC0000000
-#define LOG_GRP_SIZE sizeof(struct log_group)
-#define LOG_ENT_SIZE sizeof(struct log_entry)
-#define ARENA_MIN_SIZE (1UL << 24)	/* 16 MB */
-#define ARENA_MAX_SIZE (1ULL << 39)	/* 512 GB */
-#define RTT_VALID (1UL << 31)
-#define RTT_INVALID 0
-#define BTT_PG_SIZE 4096
-#define BTT_DEFAULT_NFREE ND_MAX_LANES
-#define LOG_SEQ_INIT 1
-
-#define IB_FLAG_ERROR 0x00000001
-#define IB_FLAG_ERROR_MASK 0x00000001
-
-#define ent_lba(ent) (ent & MAP_LBA_MASK)
-#define ent_e_flag(ent) (!!(ent & MAP_ERR_MASK))
-#define ent_z_flag(ent) (!!(ent & MAP_TRIM_MASK))
-#define set_e_flag(ent) (ent |= MAP_ERR_MASK)
+#define BTT_SIG_LEN		16
+#define BTT_SIG			"BTT_ARENA_INFO\0"
+#define MAP_ENT_SIZE		4
+#define MAP_TRIM_SHIFT		31
+#define MAP_TRIM_MASK		BIT(MAP_TRIM_SHIFT)
+#define MAP_ERR_SHIFT		30
+#define MAP_ERR_MASK		BIT(MAP_ERR_SHIFT)
+#define MAP_LBA_MASK		(~(MAP_TRIM_MASK | MAP_ERR_MASK))
+#define MAP_ENT_NORMAL		0xC0000000
+#define LOG_GRP_SIZE		sizeof(struct log_group)
+#define LOG_ENT_SIZE		sizeof(struct log_entry)
+#define ARENA_MIN_SIZE		BIT(24)		/* 16 MB */
+#define ARENA_MAX_SIZE		BIT_ULL(39)	/* 512 GB */
+#define RTT_VALID		BIT(31)
+#define RTT_INVALID		0
+#define BTT_PG_SIZE		4096
+#define BTT_DEFAULT_NFREE	ND_MAX_LANES
+#define LOG_SEQ_INIT		1
+
+#define IB_FLAG_ERROR		0x00000001
+#define IB_FLAG_ERROR_MASK	0x00000001
+
+#define ent_lba(ent)		((ent) & MAP_LBA_MASK)
+#define ent_e_flag(ent)		(!!((ent) & MAP_ERR_MASK))
+#define ent_z_flag(ent)		(!!((ent) & MAP_TRIM_MASK))
+#define set_e_flag(ent)		((ent) |= MAP_ERR_MASK)
 /* 'normal' is both e and z flags set */
-#define ent_normal(ent) (ent_e_flag(ent) && ent_z_flag(ent))
+#define ent_normal(ent)		(ent_e_flag(ent) && ent_z_flag(ent))
 
 enum btt_init_state {
 	INIT_UNCHECKED = 0,