@@ -1747,6 +1747,18 @@ static void nvme_init_subnqn(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
1747
1747
memset (ctrl -> subnqn + off , 0 , sizeof (ctrl -> subnqn ) - off );
1748
1748
}
1749
1749
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
+
1750
1762
/*
1751
1763
* Initialize the cached copies of the Identify data and various controller
1752
1764
* 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)
2579
2591
2580
2592
static void nvme_get_fw_slot_info (struct nvme_ctrl * ctrl )
2581
2593
{
2582
- struct nvme_command c = { };
2583
2594
struct nvme_fw_slot_info_log * log ;
2584
2595
2585
2596
log = kmalloc (sizeof (* log ), GFP_KERNEL );
2586
2597
if (!log )
2587
2598
return ;
2588
2599
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 )))
2594
2601
dev_warn (ctrl -> device ,
2595
2602
"Get FW SLOT INFO log error\n" );
2596
2603
kfree (log );
0 commit comments