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: convert timeouts to secs_to_jiffies()

Commit b35108a51cf7 ("jiffies: Define secs_to_jiffies()") introduced
secs_to_jiffies(). As the value here is a multiple of 1000, use
secs_to_jiffies() instead of msecs_to_jiffies() to avoid the
multiplication

This is converted using scripts/coccinelle/misc/secs_to_jiffies.cocci with
the following Coccinelle rules:

@depends on patch@
expression E;
@@

-msecs_to_jiffies(E * 1000)
+secs_to_jiffies(E)

-msecs_to_jiffies(E * MSEC_PER_SEC)
+secs_to_jiffies(E)

While here, convert some timeouts that are denominated in seconds
manually.

[akpm@linux-foundation.org: fix build]
Link: https://lkml.kernel.org/r/20250225-converge-secs-to-jiffies-part-two-v3-2-a43967e36c88@linux.microsoft.com
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
Cc: Carlos Maiolino <cem@kernel.org>
Cc: Carlos Maiolino <cmaiolino@redhat.com>
Cc: Chris Mason <clm@fb.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Damien Le Maol <dlemoal@kernel.org>
Cc: "Darrick J. Wong" <djwong@kernel.org>
Cc: David Sterba <dsterba@suse.com>
Cc: Dick Kennedy <dick.kennedy@broadcom.com>
Cc: Dongsheng Yang <dongsheng.yang@easystack.cn>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Frank Li <frank.li@nxp.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Ilpo Jarvinen <ilpo.jarvinen@linux.intel.com>
Cc: Ilya Dryomov <idryomov@gmail.com>
Cc: James Bottomley <james.bottomley@HansenPartnership.com>
Cc: James Smart <james.smart@broadcom.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Josef Bacik <josef@toxicpanda.com>
Cc: Julia Lawall <julia.lawall@inria.fr>
Cc: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@broadcom.com>
Cc: Keith Busch <kbusch@kernel.org>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Mark Brown <broonie@kernel.org>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Nicolas Palix <nicolas.palix@imag.fr>
Cc: Niklas Cassel <cassel@kernel.org>
Cc: Oded Gabbay <ogabbay@kernel.org>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Selvin Thyparampil Xavier <selvin.xavier@broadcom.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Shyam-sundar S-k <Shyam-sundar.S-k@amd.com>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Easwar Hariharan and committed by
Andrew Morton
84c34d01 15c200ea

+34 -47
+1 -2
drivers/scsi/lpfc/lpfc.h
··· 74 74 * queue depths when there are driver resource error or Firmware 75 75 * resource error. 76 76 */ 77 - /* 1 Second */ 78 - #define QUEUE_RAMP_DOWN_INTERVAL (msecs_to_jiffies(1000 * 1)) 77 + #define QUEUE_RAMP_DOWN_INTERVAL (secs_to_jiffies(1)) 79 78 80 79 /* Number of exchanges reserved for discovery to complete */ 81 80 #define LPFC_DISC_IOCB_BUFF_COUNT 20
+5 -6
drivers/scsi/lpfc/lpfc_els.c
··· 8045 8045 if (test_bit(FC_DISC_TMO, &vport->fc_flag)) { 8046 8046 tmo = ((phba->fc_ratov * 3) + 3); 8047 8047 mod_timer(&vport->fc_disctmo, 8048 - jiffies + 8049 - msecs_to_jiffies(1000 * tmo)); 8048 + jiffies + secs_to_jiffies(tmo)); 8050 8049 } 8051 8050 return 0; 8052 8051 } ··· 8080 8081 if (test_bit(FC_DISC_TMO, &vport->fc_flag)) { 8081 8082 tmo = ((phba->fc_ratov * 3) + 3); 8082 8083 mod_timer(&vport->fc_disctmo, 8083 - jiffies + msecs_to_jiffies(1000 * tmo)); 8084 + jiffies + secs_to_jiffies(tmo)); 8084 8085 } 8085 8086 if ((rscn_cnt < FC_MAX_HOLD_RSCN) && 8086 8087 !test_bit(FC_RSCN_DISCOVERY, &vport->fc_flag)) { ··· 9510 9511 if (!list_empty(&pring->txcmplq)) 9511 9512 if (!test_bit(FC_UNLOADING, &phba->pport->load_flag)) 9512 9513 mod_timer(&vport->els_tmofunc, 9513 - jiffies + msecs_to_jiffies(1000 * timeout)); 9514 + jiffies + secs_to_jiffies(timeout)); 9514 9515 } 9515 9516 9516 9517 /** ··· 10898 10899 "3334 Delay fc port discovery for %d secs\n", 10899 10900 phba->fc_ratov); 10900 10901 mod_timer(&vport->delayed_disc_tmo, 10901 - jiffies + msecs_to_jiffies(1000 * phba->fc_ratov)); 10902 + jiffies + secs_to_jiffies(phba->fc_ratov)); 10902 10903 return; 10903 10904 } 10904 10905 ··· 11155 11156 if (!ndlp) 11156 11157 return; 11157 11158 11158 - mod_timer(&ndlp->nlp_delayfunc, jiffies + msecs_to_jiffies(1000)); 11159 + mod_timer(&ndlp->nlp_delayfunc, jiffies + secs_to_jiffies(1)); 11159 11160 set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag); 11160 11161 ndlp->nlp_last_elscmd = ELS_CMD_FLOGI; 11161 11162 phba->pport->port_state = LPFC_FLOGI;
+1 -1
drivers/scsi/lpfc/lpfc_hbadisc.c
··· 4973 4973 tmo, vport->port_state, vport->fc_flag); 4974 4974 } 4975 4975 4976 - mod_timer(&vport->fc_disctmo, jiffies + msecs_to_jiffies(1000 * tmo)); 4976 + mod_timer(&vport->fc_disctmo, jiffies + secs_to_jiffies(tmo)); 4977 4977 set_bit(FC_DISC_TMO, &vport->fc_flag); 4978 4978 4979 4979 /* Start Discovery Timer state <hba_state> */
+5 -5
drivers/scsi/lpfc/lpfc_init.c
··· 595 595 /* Set up ring-0 (ELS) timer */ 596 596 timeout = phba->fc_ratov * 2; 597 597 mod_timer(&vport->els_tmofunc, 598 - jiffies + msecs_to_jiffies(1000 * timeout)); 598 + jiffies + secs_to_jiffies(timeout)); 599 599 /* Set up heart beat (HB) timer */ 600 600 mod_timer(&phba->hb_tmofunc, 601 601 jiffies + secs_to_jiffies(LPFC_HB_MBOX_INTERVAL)); ··· 604 604 phba->last_completion_time = jiffies; 605 605 /* Set up error attention (ERATT) polling timer */ 606 606 mod_timer(&phba->eratt_poll, 607 - jiffies + msecs_to_jiffies(1000 * phba->eratt_poll_interval)); 607 + jiffies + secs_to_jiffies(phba->eratt_poll_interval)); 608 608 609 609 if (test_bit(LINK_DISABLED, &phba->hba_flag)) { 610 610 lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, ··· 3361 3361 /* Determine how long we might wait for the active mailbox 3362 3362 * command to be gracefully completed by firmware. 3363 3363 */ 3364 - timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, 3365 - phba->sli.mbox_active) * 1000) + jiffies; 3364 + timeout = secs_to_jiffies(lpfc_mbox_tmo_val(phba, 3365 + phba->sli.mbox_active)) + jiffies; 3366 3366 } 3367 3367 spin_unlock_irqrestore(&phba->hbalock, iflag); 3368 3368 ··· 6909 6909 * re-instantiate the Vlink using FDISC. 6910 6910 */ 6911 6911 mod_timer(&ndlp->nlp_delayfunc, 6912 - jiffies + msecs_to_jiffies(1000)); 6912 + jiffies + secs_to_jiffies(1)); 6913 6913 set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag); 6914 6914 ndlp->nlp_last_elscmd = ELS_CMD_FDISC; 6915 6915 vport->port_state = LPFC_FDISC;
+5 -7
drivers/scsi/lpfc/lpfc_scsi.c
··· 5645 5645 * cmd_flag is set to LPFC_DRIVER_ABORTED before we wait 5646 5646 * for abort to complete. 5647 5647 */ 5648 - wait_event_timeout(waitq, 5649 - (lpfc_cmd->pCmd != cmnd), 5650 - msecs_to_jiffies(2*vport->cfg_devloss_tmo*1000)); 5648 + wait_event_timeout(waitq, (lpfc_cmd->pCmd != cmnd), 5649 + secs_to_jiffies(2*vport->cfg_devloss_tmo)); 5651 5650 5652 5651 spin_lock(&lpfc_cmd->buf_lock); 5653 5652 ··· 5910 5911 * If target is not in a MAPPED state, delay until 5911 5912 * target is rediscovered or devloss timeout expires. 5912 5913 */ 5913 - later = msecs_to_jiffies(2 * vport->cfg_devloss_tmo * 1000) + jiffies; 5914 + later = secs_to_jiffies(2 * vport->cfg_devloss_tmo) + jiffies; 5914 5915 while (time_after(later, jiffies)) { 5915 5916 if (!pnode) 5916 5917 return FAILED; ··· 5956 5957 lpfc_sli_abort_taskmgmt(vport, 5957 5958 &phba->sli.sli3_ring[LPFC_FCP_RING], 5958 5959 tgt_id, lun_id, context); 5959 - later = msecs_to_jiffies(2 * vport->cfg_devloss_tmo * 1000) + jiffies; 5960 + later = secs_to_jiffies(2 * vport->cfg_devloss_tmo) + jiffies; 5960 5961 while (time_after(later, jiffies) && cnt) { 5961 5962 schedule_timeout_uninterruptible(msecs_to_jiffies(20)); 5962 5963 cnt = lpfc_sli_sum_iocb(vport, tgt_id, lun_id, context); ··· 6136 6137 wait_event_timeout(waitq, 6137 6138 !test_bit(NLP_WAIT_FOR_LOGO, 6138 6139 &pnode->save_flags), 6139 - msecs_to_jiffies(dev_loss_tmo * 6140 - 1000)); 6140 + secs_to_jiffies(dev_loss_tmo)); 6141 6141 6142 6142 if (test_and_clear_bit(NLP_WAIT_FOR_LOGO, 6143 6143 &pnode->save_flags))
+16 -25
drivers/scsi/lpfc/lpfc_sli.c
··· 1025 1025 LIST_HEAD(send_rrq); 1026 1026 1027 1027 clear_bit(HBA_RRQ_ACTIVE, &phba->hba_flag); 1028 - next_time = jiffies + msecs_to_jiffies(1000 * (phba->fc_ratov + 1)); 1028 + next_time = jiffies + secs_to_jiffies(phba->fc_ratov + 1); 1029 1029 spin_lock_irqsave(&phba->rrq_list_lock, iflags); 1030 1030 list_for_each_entry_safe(rrq, nextrrq, 1031 1031 &phba->active_rrq_list, list) { ··· 1208 1208 else 1209 1209 rrq->send_rrq = 0; 1210 1210 rrq->xritag = xritag; 1211 - rrq->rrq_stop_time = jiffies + 1212 - msecs_to_jiffies(1000 * (phba->fc_ratov + 1)); 1211 + rrq->rrq_stop_time = jiffies + secs_to_jiffies(phba->fc_ratov + 1); 1213 1212 rrq->nlp_DID = ndlp->nlp_DID; 1214 1213 rrq->vport = ndlp->vport; 1215 1214 rrq->rxid = rxid; ··· 1735 1736 BUG_ON(!piocb->vport); 1736 1737 if (!test_bit(FC_UNLOADING, &piocb->vport->load_flag)) 1737 1738 mod_timer(&piocb->vport->els_tmofunc, 1738 - jiffies + 1739 - msecs_to_jiffies(1000 * (phba->fc_ratov << 1))); 1739 + jiffies + secs_to_jiffies(phba->fc_ratov << 1)); 1740 1740 } 1741 1741 1742 1742 return 0; ··· 3954 3956 else 3955 3957 /* Restart the timer for next eratt poll */ 3956 3958 mod_timer(&phba->eratt_poll, 3957 - jiffies + 3958 - msecs_to_jiffies(1000 * phba->eratt_poll_interval)); 3959 + jiffies + secs_to_jiffies(phba->eratt_poll_interval)); 3959 3960 return; 3960 3961 } 3961 3962 ··· 9005 9008 9006 9009 /* Start the ELS watchdog timer */ 9007 9010 mod_timer(&vport->els_tmofunc, 9008 - jiffies + msecs_to_jiffies(1000 * (phba->fc_ratov * 2))); 9011 + jiffies + secs_to_jiffies(phba->fc_ratov * 2)); 9009 9012 9010 9013 /* Start heart beat timer */ 9011 9014 mod_timer(&phba->hb_tmofunc, ··· 9024 9027 9025 9028 /* Start error attention (ERATT) polling timer */ 9026 9029 mod_timer(&phba->eratt_poll, 9027 - jiffies + msecs_to_jiffies(1000 * phba->eratt_poll_interval)); 9030 + jiffies + secs_to_jiffies(phba->eratt_poll_interval)); 9028 9031 9029 9032 /* 9030 9033 * The port is ready, set the host's link state to LINK_DOWN ··· 9501 9504 goto out_not_finished; 9502 9505 } 9503 9506 /* timeout active mbox command */ 9504 - timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, pmbox) * 9505 - 1000); 9507 + timeout = secs_to_jiffies(lpfc_mbox_tmo_val(phba, pmbox)); 9506 9508 mod_timer(&psli->mbox_tmo, jiffies + timeout); 9507 9509 } 9508 9510 ··· 9625 9629 drvr_flag); 9626 9630 goto out_not_finished; 9627 9631 } 9628 - timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, pmbox) * 9629 - 1000) + jiffies; 9632 + timeout = secs_to_jiffies(lpfc_mbox_tmo_val(phba, pmbox)) + jiffies; 9630 9633 i = 0; 9631 9634 /* Wait for command to complete */ 9632 9635 while (((word0 & OWN_CHIP) == OWN_CHIP) || ··· 9751 9756 * command to be gracefully completed by firmware. 9752 9757 */ 9753 9758 if (phba->sli.mbox_active) 9754 - timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, 9755 - phba->sli.mbox_active) * 9756 - 1000) + jiffies; 9759 + timeout = secs_to_jiffies(lpfc_mbox_tmo_val(phba, 9760 + phba->sli.mbox_active)) + jiffies; 9757 9761 spin_unlock_irq(&phba->hbalock); 9758 9762 9759 9763 /* Make sure the mailbox is really active */ ··· 9875 9881 } 9876 9882 } 9877 9883 9878 - timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, mboxq) 9879 - * 1000) + jiffies; 9884 + timeout = secs_to_jiffies(lpfc_mbox_tmo_val(phba, mboxq)) + jiffies; 9880 9885 9881 9886 do { 9882 9887 bmbx_reg.word0 = readl(phba->sli4_hba.BMBXregaddr); ··· 10223 10230 10224 10231 /* Start timer for the mbox_tmo and log some mailbox post messages */ 10225 10232 mod_timer(&psli->mbox_tmo, (jiffies + 10226 - msecs_to_jiffies(1000 * lpfc_mbox_tmo_val(phba, mboxq)))); 10233 + secs_to_jiffies(lpfc_mbox_tmo_val(phba, mboxq)))); 10227 10234 10228 10235 lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, 10229 10236 "(%d):0355 Mailbox cmd x%x (x%x/x%x) issue Data: " ··· 13152 13159 retval = lpfc_sli_issue_iocb(phba, ring_number, piocb, 13153 13160 SLI_IOCB_RET_IOCB); 13154 13161 if (retval == IOCB_SUCCESS) { 13155 - timeout_req = msecs_to_jiffies(timeout * 1000); 13162 + timeout_req = secs_to_jiffies(timeout); 13156 13163 timeleft = wait_event_timeout(done_q, 13157 13164 lpfc_chk_iocb_flg(phba, piocb, LPFC_IO_WAKE), 13158 13165 timeout_req); ··· 13268 13275 /* now issue the command */ 13269 13276 retval = lpfc_sli_issue_mbox(phba, pmboxq, MBX_NOWAIT); 13270 13277 if (retval == MBX_BUSY || retval == MBX_SUCCESS) { 13271 - wait_for_completion_timeout(&mbox_done, 13272 - msecs_to_jiffies(timeout * 1000)); 13278 + wait_for_completion_timeout(&mbox_done, secs_to_jiffies(timeout)); 13273 13279 13274 13280 spin_lock_irqsave(&phba->hbalock, flag); 13275 13281 pmboxq->ctx_u.mbox_wait = NULL; ··· 13328 13336 * command to be gracefully completed by firmware. 13329 13337 */ 13330 13338 if (phba->sli.mbox_active) 13331 - timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, 13332 - phba->sli.mbox_active) * 13333 - 1000) + jiffies; 13339 + timeout = secs_to_jiffies(lpfc_mbox_tmo_val(phba, 13340 + phba->sli.mbox_active)) + jiffies; 13334 13341 spin_unlock_irq(&phba->hbalock); 13335 13342 13336 13343 /* Enable softirqs again, done with phba->hbalock */
+1 -1
drivers/scsi/lpfc/lpfc_vport.c
··· 246 246 * fabric RA_TOV value and dev_loss tmo. The driver's 247 247 * devloss_tmo is 10 giving this loop a 3x multiplier minimally. 248 248 */ 249 - wait_time_max = msecs_to_jiffies(((phba->fc_ratov * 3) + 3) * 1000); 249 + wait_time_max = secs_to_jiffies((phba->fc_ratov * 3) + 3); 250 250 wait_time_max += jiffies; 251 251 start_time = jiffies; 252 252 while (time_before(jiffies, wait_time_max)) {