Skip to content

Commit 21e45d8

Browse files
ikegami-tigaw
authored andcommitted
nvme-print-json: update id-ctrl print code to use libnvme definition
Use libnvme register definitions instead of the shift operator. Signed-off-by: Tokunori Ikegami <[email protected]>
1 parent eb6014a commit 21e45d8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

nvme-print-json.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,9 @@ void json_nvme_id_ctrl(struct nvme_id_ctrl *ctrl,
450450
struct json_object *psd = json_create_object();
451451

452452
obj_add_int(psd, "max_power", le16_to_cpu(ctrl->psd[i].mp));
453-
obj_add_int(psd, "max_power_scale", ctrl->psd[i].flags & 0x1);
454-
obj_add_int(psd, "non-operational_state", (ctrl->psd[i].flags & 2) >> 1);
453+
obj_add_int(psd, "max_power_scale", ctrl->psd[i].flags & NVME_PSD_FLAGS_MXPS);
454+
obj_add_int(psd, "non-operational_state",
455+
!!(ctrl->psd[i].flags & NVME_PSD_FLAGS_NOPS));
455456
obj_add_uint(psd, "entry_lat", le32_to_cpu(ctrl->psd[i].enlat));
456457
obj_add_uint(psd, "exit_lat", le32_to_cpu(ctrl->psd[i].exlat));
457458
obj_add_int(psd, "read_tput", ctrl->psd[i].rrt);

0 commit comments

Comments
 (0)