Skip to content

Commit

Permalink
nvme-print-json: update id-ctrl print code to use libnvme definition
Browse files Browse the repository at this point in the history
Use libnvme register definitions instead of the shift operator.

Signed-off-by: Tokunori Ikegami <[email protected]>
  • Loading branch information
ikegami-t committed Dec 31, 2024
1 parent 1c3c9fa commit 4494ea2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nvme-print-json.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,9 @@ void json_nvme_id_ctrl(struct nvme_id_ctrl *ctrl,
struct json_object *psd = json_create_object();

obj_add_int(psd, "max_power", le16_to_cpu(ctrl->psd[i].mp));
obj_add_int(psd, "max_power_scale", ctrl->psd[i].flags & 0x1);
obj_add_int(psd, "non-operational_state", (ctrl->psd[i].flags & 2) >> 1);
obj_add_int(psd, "max_power_scale", ctrl->psd[i].flags & NVME_PSD_FLAGS_MXPS);
obj_add_int(psd, "non-operational_state",
!!(ctrl->psd[i].flags & NVME_PSD_FLAGS_NOPS));
obj_add_uint(psd, "entry_lat", le32_to_cpu(ctrl->psd[i].enlat));
obj_add_uint(psd, "exit_lat", le32_to_cpu(ctrl->psd[i].exlat));
obj_add_int(psd, "read_tput", ctrl->psd[i].rrt);
Expand Down

0 comments on commit 4494ea2

Please sign in to comment.