[PATCH 3/4] nvmet: use nvme_nidt_len() helper for id-desc
Chaitanya Kulkarni
chaitanya.kulkarni at wdc.com
Mon May 17 22:05:56 PDT 2021
Use the previously added helper to remove the open coding of the
NVME_NIDT_XXX_LEN for target.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
drivers/nvme/target/admin-cmd.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index dcd49a72f2f3..1a58719ef952 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -7,6 +7,7 @@
#include <linux/module.h>
#include <linux/rculist.h>
#include <linux/part_stat.h>
+#include <linux/nvme.h>
#include <generated/utsrelease.h>
#include <asm/unaligned.h>
@@ -622,15 +623,16 @@ static void nvmet_execute_identify_desclist(struct nvmet_req *req)
if (memchr_inv(&req->ns->uuid, 0, sizeof(req->ns->uuid))) {
status = nvmet_copy_ns_identifier(req, NVME_NIDT_UUID,
- NVME_NIDT_UUID_LEN,
+ nvme_nidt_len(NVME_NIDT_UUID),
&req->ns->uuid, &off);
if (status)
goto out;
}
if (memchr_inv(req->ns->nguid, 0, sizeof(req->ns->nguid))) {
+ u8 len = nvme_nidt_len(NVME_NIDT_NGUID);
+
status = nvmet_copy_ns_identifier(req, NVME_NIDT_NGUID,
- NVME_NIDT_NGUID_LEN,
- &req->ns->nguid, &off);
+ len, &req->ns->nguid, &off);
if (status)
goto out;
}
--
2.22.1
More information about the Linux-nvme
mailing list