Skip to content

Commit c627c48

Browse files
Keith Buschaxboe
authored andcommitted
nvme: factor get log into a helper
And fix the warning on a successful firmware log. Reviewed-by: Javier González <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Keith Busch <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 715ea9e commit c627c48

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

drivers/nvme/host/core.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,6 +1747,18 @@ static void nvme_init_subnqn(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
17471747
memset(ctrl->subnqn + off, 0, sizeof(ctrl->subnqn) - off);
17481748
}
17491749

1750+
static int nvme_get_log(struct nvme_ctrl *ctrl, u8 log_page, void *log,
1751+
size_t size)
1752+
{
1753+
struct nvme_command c = { };
1754+
1755+
c.common.opcode = nvme_admin_get_log_page;
1756+
c.common.nsid = cpu_to_le32(NVME_NSID_ALL);
1757+
c.common.cdw10[0] = nvme_get_log_dw10(log_page, size);
1758+
1759+
return nvme_submit_sync_cmd(ctrl->admin_q, &c, log, size);
1760+
}
1761+
17501762
/*
17511763
* Initialize the cached copies of the Identify data and various controller
17521764
* register in our nvme_ctrl structure. This should be called as soon as
@@ -2579,18 +2591,13 @@ static bool nvme_ctrl_pp_status(struct nvme_ctrl *ctrl)
25792591

25802592
static void nvme_get_fw_slot_info(struct nvme_ctrl *ctrl)
25812593
{
2582-
struct nvme_command c = { };
25832594
struct nvme_fw_slot_info_log *log;
25842595

25852596
log = kmalloc(sizeof(*log), GFP_KERNEL);
25862597
if (!log)
25872598
return;
25882599

2589-
c.common.opcode = nvme_admin_get_log_page;
2590-
c.common.nsid = cpu_to_le32(NVME_NSID_ALL);
2591-
c.common.cdw10[0] = nvme_get_log_dw10(NVME_LOG_FW_SLOT, sizeof(*log));
2592-
2593-
if (!nvme_submit_sync_cmd(ctrl->admin_q, &c, log, sizeof(*log)))
2600+
if (nvme_get_log(ctrl, NVME_LOG_FW_SLOT, log, sizeof(*log)))
25942601
dev_warn(ctrl->device,
25952602
"Get FW SLOT INFO log error\n");
25962603
kfree(log);

0 commit comments

Comments
 (0)