Skip to content

Commit 466ff7d

Browse files
ikegami-tigaw
authored andcommitted
nvme-print-stdout: Use NVME_SET_FEAT_EVENT register definitions
Change it instead of hardcoded register mask and shift values. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
1 parent afe92cc commit 466ff7d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

nvme-print-stdout.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -483,13 +483,13 @@ static void stdout_persistent_event_log(void *pevent_log_info,
483483
case NVME_PEL_SET_FEATURE_EVENT:
484484
set_feat_event = pevent_log_info + offset;
485485
printf("Set Feature Event Entry:\n");
486-
dword_cnt = set_feat_event->layout & 0x03;
487-
fid = le32_to_cpu(set_feat_event->cdw_mem[0]) & 0x000f;
486+
dword_cnt = NVME_SET_FEAT_EVENT_DW_COUNT(set_feat_event->layout);
487+
fid = NVME_GET(le32_to_cpu(set_feat_event->cdw_mem[0]), FEATURES_CDW10_FID);
488488
cdw11 = le32_to_cpu(set_feat_event->cdw_mem[1]);
489489

490490
printf("Set Feature ID :%#02x (%s), value:%#08x\n", fid,
491491
nvme_feature_to_string(fid), cdw11);
492-
if (((set_feat_event->layout & 0xff) >> 2) != 0) {
492+
if (NVME_SET_FEAT_EVENT_MB_COUNT(set_feat_event->layout)) {
493493
mem_buf = (unsigned char *)(set_feat_event + 4 + dword_cnt * 4);
494494
stdout_feature_show_fields(fid, cdw11, mem_buf);
495495
}

0 commit comments

Comments
 (0)