Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: lpfc: use min() to improve code

Use min_t() to reduce the code in lpfc_sli4_driver_resource_setup() and
lpfc_nvme_prep_io_cmd(), and improve readability.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Link: https://lore.kernel.org/r/20250815121609.384914-4-rongqianfeng@vivo.com
Reviewed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Qianfeng Rong and committed by
Martin K. Petersen
e79aa10e 0138c168

+3 -10
+1 -4
drivers/scsi/lpfc/lpfc_init.c
··· 8300 8300 phba->cfg_total_seg_cnt, phba->cfg_scsi_seg_cnt, 8301 8301 phba->cfg_nvme_seg_cnt); 8302 8302 8303 - if (phba->cfg_sg_dma_buf_size < SLI4_PAGE_SIZE) 8304 - i = phba->cfg_sg_dma_buf_size; 8305 - else 8306 - i = SLI4_PAGE_SIZE; 8303 + i = min(phba->cfg_sg_dma_buf_size, SLI4_PAGE_SIZE); 8307 8304 8308 8305 phba->lpfc_sg_dma_buf_pool = 8309 8306 dma_pool_create("lpfc_sg_dma_buf_pool",
+2 -6
drivers/scsi/lpfc/lpfc_nvme.c
··· 1234 1234 if ((phba->cfg_nvme_enable_fb) && 1235 1235 test_bit(NLP_FIRSTBURST, &pnode->nlp_flag)) { 1236 1236 req_len = lpfc_ncmd->nvmeCmd->payload_length; 1237 - if (req_len < pnode->nvme_fb_size) 1238 - wqe->fcp_iwrite.initial_xfer_len = 1239 - req_len; 1240 - else 1241 - wqe->fcp_iwrite.initial_xfer_len = 1242 - pnode->nvme_fb_size; 1237 + wqe->fcp_iwrite.initial_xfer_len = min(req_len, 1238 + pnode->nvme_fb_size); 1243 1239 } else { 1244 1240 wqe->fcp_iwrite.initial_xfer_len = 0; 1245 1241 }