Messages in this thread Patch in this message | | | From | Joe Perches <> | Subject | [PATCH 09/13] nvdimm: btt.h: Neaten #defines to improve readability | Date | Wed, 11 Sep 2019 19:54:39 -0700 |
| |
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(-)
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, -- 2.15.0
| |