Use SECTOR_SHIFT instead of its hard coded value 9. Also add a comment
to decribe this helper.

Signed-off-by: Damien Le Moal <damien.lem...@wdc.com>
---
 drivers/nvme/host/nvme.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 22e8401352c2..a979b62ea4b2 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -419,9 +419,12 @@ static inline int nvme_reset_subsystem(struct nvme_ctrl 
*ctrl)
        return ctrl->ops->reg_write32(ctrl, NVME_REG_NSSR, 0x4E564D65);
 }
 
+/*
+ * Convert a 512B sector number to a block number.
+ */
 static inline u64 nvme_block_nr(struct nvme_ns *ns, sector_t sector)
 {
-       return (sector >> (ns->lba_shift - 9));
+       return sector >> (ns->lba_shift - SECTOR_SHIFT);
 }
 
 static inline void nvme_end_request(struct request *req, __le16 status,
-- 
2.21.0

Reply via email to