Use block layer definition instead of re-defining it with the same values. Suggested-by: Christoph Hellwig <hch@xxxxxx> Reviewed-by: Christoph Hellwig <hch@xxxxxx> Signed-off-by: Max Gurtovoy <maxg@xxxxxxxxxxxx> --- changes from v3: - added Reviewed-by signature --- drivers/nvme/host/core.c | 12 ++++++------ include/linux/nvme.h | 3 --- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index bdc0a64..a1c0ce0 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -663,11 +663,11 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns, } switch (req->rq_disk->protection_type) { - case NVME_NS_DPS_PI_TYPE3: + case T10_PI_TYPE3_PROTECTION: control |= NVME_RW_PRINFO_PRCHK_GUARD; break; - case NVME_NS_DPS_PI_TYPE1: - case NVME_NS_DPS_PI_TYPE2: + case T10_PI_TYPE1_PROTECTION: + case T10_PI_TYPE2_PROTECTION: control |= NVME_RW_PRINFO_PRCHK_GUARD | NVME_RW_PRINFO_PRCHK_REF; cmnd->rw.reftag = cpu_to_le32(t10_pi_ref_tag(req)); @@ -1498,13 +1498,13 @@ static void nvme_init_integrity(struct gendisk *disk, u16 ms) memset(&integrity, 0, sizeof(integrity)); switch (disk->protection_type) { - case NVME_NS_DPS_PI_TYPE3: + case T10_PI_TYPE3_PROTECTION: integrity.profile = &t10_pi_type3_crc; integrity.tag_size = sizeof(u16) + sizeof(u32); integrity.flags |= BLK_INTEGRITY_DEVICE_CAPABLE; break; - case NVME_NS_DPS_PI_TYPE1: - case NVME_NS_DPS_PI_TYPE2: + case T10_PI_TYPE1_PROTECTION: + case T10_PI_TYPE2_PROTECTION: integrity.profile = &t10_pi_type1_crc; integrity.tag_size = sizeof(u16); integrity.flags |= BLK_INTEGRITY_DEVICE_CAPABLE; diff --git a/include/linux/nvme.h b/include/linux/nvme.h index 01aa6a6..8d45c3e 100644 --- a/include/linux/nvme.h +++ b/include/linux/nvme.h @@ -381,9 +381,6 @@ enum { NVME_NS_DPC_PI_TYPE1 = 1 << 0, NVME_NS_DPS_PI_FIRST = 1 << 3, NVME_NS_DPS_PI_MASK = 0x7, - NVME_NS_DPS_PI_TYPE1 = 1, - NVME_NS_DPS_PI_TYPE2 = 2, - NVME_NS_DPS_PI_TYPE3 = 3, }; struct nvme_ns_id_desc { -- 1.8.3.1