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:

@@ constant C; @@

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

@@ constant C; @@

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

Link: https://lkml.kernel.org/r/20241210-converge-secs-to-jiffies-v3-9-ddfefd7e9f2a@linux.microsoft.com
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: Anna-Maria Behnsen <anna-maria@linutronix.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Daniel Mack <daniel@zonque.org>
Cc: David Airlie <airlied@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Dick Kennedy <dick.kennedy@broadcom.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Florian Fainelli <florian.fainelli@broadcom.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Ilya Dryomov <idryomov@gmail.com>
Cc: Jack Wang <jinpu.wang@cloud.ionos.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: James Smart <james.smart@broadcom.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Jeff Johnson <jjohnson@kernel.org>
Cc: Jeff Johnson <quic_jjohnson@quicinc.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Jeroen de Borst <jeroendb@google.com>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Joe Lawrence <joe.lawrence@redhat.com>
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: Jozsef Kadlecsik <kadlec@netfilter.org>
Cc: Julia Lawall <julia.lawall@inria.fr>
Cc: Kalle Valo <kvalo@kernel.org>
Cc: Louis Peens <louis.peens@corigine.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Miroslav Benes <mbenes@suse.cz>
Cc: Naveen N Rao <naveen@kernel.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Nicolas Palix <nicolas.palix@imag.fr>
Cc: Oded Gabbay <ogabbay@kernel.org>
Cc: Ofir Bitton <obitton@habana.ai>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Praveen Kaligineedi <pkaligineedi@google.com>
Cc: Ray Jui <rjui@broadcom.com>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Roger Pau Monné <roger.pau@citrix.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Scott Branden <sbranden@broadcom.com>
Cc: Shailend Chand <shailend@google.com>
Cc: Simona Vetter <simona@ffwll.ch>
Cc: Simon Horman <horms@kernel.org>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Easwar Hariharan and committed by
Andrew Morton
84bbaeb0 b4aa02fb

+17 -17
+9 -9
drivers/scsi/lpfc/lpfc_init.c
··· 598 598 jiffies + msecs_to_jiffies(1000 * timeout)); 599 599 /* Set up heart beat (HB) timer */ 600 600 mod_timer(&phba->hb_tmofunc, 601 - jiffies + msecs_to_jiffies(1000 * LPFC_HB_MBOX_INTERVAL)); 601 + jiffies + secs_to_jiffies(LPFC_HB_MBOX_INTERVAL)); 602 602 clear_bit(HBA_HBEAT_INP, &phba->hba_flag); 603 603 clear_bit(HBA_HBEAT_TMO, &phba->hba_flag); 604 604 phba->last_completion_time = jiffies; ··· 1267 1267 !test_bit(FC_UNLOADING, &phba->pport->load_flag)) 1268 1268 mod_timer(&phba->hb_tmofunc, 1269 1269 jiffies + 1270 - msecs_to_jiffies(1000 * LPFC_HB_MBOX_INTERVAL)); 1270 + secs_to_jiffies(LPFC_HB_MBOX_INTERVAL)); 1271 1271 return; 1272 1272 } 1273 1273 ··· 1555 1555 /* If IOs are completing, no need to issue a MBX_HEARTBEAT */ 1556 1556 spin_lock_irq(&phba->pport->work_port_lock); 1557 1557 if (time_after(phba->last_completion_time + 1558 - msecs_to_jiffies(1000 * LPFC_HB_MBOX_INTERVAL), 1558 + secs_to_jiffies(LPFC_HB_MBOX_INTERVAL), 1559 1559 jiffies)) { 1560 1560 spin_unlock_irq(&phba->pport->work_port_lock); 1561 1561 if (test_bit(HBA_HBEAT_INP, &phba->hba_flag)) ··· 3354 3354 spin_unlock_irqrestore(&phba->hbalock, iflag); 3355 3355 if (mbx_action == LPFC_MBX_NO_WAIT) 3356 3356 return; 3357 - timeout = msecs_to_jiffies(LPFC_MBOX_TMO * 1000) + jiffies; 3357 + timeout = secs_to_jiffies(LPFC_MBOX_TMO) + jiffies; 3358 3358 spin_lock_irqsave(&phba->hbalock, iflag); 3359 3359 if (phba->sli.mbox_active) { 3360 3360 actcmd = phba->sli.mbox_active->u.mb.mbxCommand; ··· 4924 4924 stat = 1; 4925 4925 goto finished; 4926 4926 } 4927 - if (time >= msecs_to_jiffies(30 * 1000)) { 4927 + if (time >= secs_to_jiffies(30)) { 4928 4928 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 4929 4929 "0461 Scanning longer than 30 " 4930 4930 "seconds. Continuing initialization\n"); 4931 4931 stat = 1; 4932 4932 goto finished; 4933 4933 } 4934 - if (time >= msecs_to_jiffies(15 * 1000) && 4934 + if (time >= secs_to_jiffies(15) && 4935 4935 phba->link_state <= LPFC_LINK_DOWN) { 4936 4936 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, 4937 4937 "0465 Link down longer than 15 " ··· 4945 4945 if (vport->num_disc_nodes || vport->fc_prli_sent) 4946 4946 goto finished; 4947 4947 if (!atomic_read(&vport->fc_map_cnt) && 4948 - time < msecs_to_jiffies(2 * 1000)) 4948 + time < secs_to_jiffies(2)) 4949 4949 goto finished; 4950 4950 if ((phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) != 0) 4951 4951 goto finished; ··· 5179 5179 lpfc_worker_wake_up(phba); 5180 5180 5181 5181 /* restart the timer for the next iteration */ 5182 - mod_timer(&phba->inactive_vmid_poll, jiffies + msecs_to_jiffies(1000 * 5183 - LPFC_VMID_TIMER)); 5182 + mod_timer(&phba->inactive_vmid_poll, 5183 + jiffies + secs_to_jiffies(LPFC_VMID_TIMER)); 5184 5184 } 5185 5185 5186 5186 /**
+4 -4
drivers/scsi/lpfc/lpfc_nportdisc.c
··· 906 906 (ndlp->nlp_state >= NLP_STE_ADISC_ISSUE || 907 907 ndlp->nlp_state <= NLP_STE_PRLI_ISSUE)) { 908 908 mod_timer(&ndlp->nlp_delayfunc, 909 - jiffies + msecs_to_jiffies(1000 * 1)); 909 + jiffies + secs_to_jiffies(1)); 910 910 set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag); 911 911 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; 912 912 lpfc_printf_vlog(vport, KERN_INFO, ··· 1332 1332 } 1333 1333 1334 1334 /* Put ndlp in npr state set plogi timer for 1 sec */ 1335 - mod_timer(&ndlp->nlp_delayfunc, jiffies + msecs_to_jiffies(1000 * 1)); 1335 + mod_timer(&ndlp->nlp_delayfunc, jiffies + secs_to_jiffies(1)); 1336 1336 set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag); 1337 1337 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; 1338 1338 ndlp->nlp_prev_state = NLP_STE_PLOGI_ISSUE; ··· 1936 1936 1937 1937 /* Put ndlp in npr state set plogi timer for 1 sec */ 1938 1938 mod_timer(&ndlp->nlp_delayfunc, 1939 - jiffies + msecs_to_jiffies(1000 * 1)); 1939 + jiffies + secs_to_jiffies(1)); 1940 1940 set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag); 1941 1941 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; 1942 1942 ··· 2743 2743 2744 2744 if (!test_bit(NLP_DELAY_TMO, &ndlp->nlp_flag)) { 2745 2745 mod_timer(&ndlp->nlp_delayfunc, 2746 - jiffies + msecs_to_jiffies(1000 * 1)); 2746 + jiffies + secs_to_jiffies(1)); 2747 2747 set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag); 2748 2748 clear_bit(NLP_NPR_ADISC, &ndlp->nlp_flag); 2749 2749 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI;
+1 -1
drivers/scsi/lpfc/lpfc_nvme.c
··· 2237 2237 * wait. Print a message if a 10 second wait expires and renew the 2238 2238 * wait. This is unexpected. 2239 2239 */ 2240 - wait_tmo = msecs_to_jiffies(LPFC_NVME_WAIT_TMO * 1000); 2240 + wait_tmo = secs_to_jiffies(LPFC_NVME_WAIT_TMO); 2241 2241 while (true) { 2242 2242 ret = wait_for_completion_timeout(lport_unreg_cmp, wait_tmo); 2243 2243 if (unlikely(!ret)) {
+2 -2
drivers/scsi/lpfc/lpfc_sli.c
··· 9012 9012 9013 9013 /* Start heart beat timer */ 9014 9014 mod_timer(&phba->hb_tmofunc, 9015 - jiffies + msecs_to_jiffies(1000 * LPFC_HB_MBOX_INTERVAL)); 9015 + jiffies + secs_to_jiffies(LPFC_HB_MBOX_INTERVAL)); 9016 9016 clear_bit(HBA_HBEAT_INP, &phba->hba_flag); 9017 9017 clear_bit(HBA_HBEAT_TMO, &phba->hba_flag); 9018 9018 phba->last_completion_time = jiffies; ··· 13323 13323 lpfc_sli_mbox_sys_flush(phba); 13324 13324 return; 13325 13325 } 13326 - timeout = msecs_to_jiffies(LPFC_MBOX_TMO * 1000) + jiffies; 13326 + timeout = secs_to_jiffies(LPFC_MBOX_TMO) + jiffies; 13327 13327 13328 13328 /* Disable softirqs, including timers from obtaining phba->hbalock */ 13329 13329 local_bh_disable();
+1 -1
drivers/scsi/lpfc/lpfc_vmid.c
··· 278 278 if (!(vport->phba->pport->vmid_flag & LPFC_VMID_TIMER_ENBLD)) { 279 279 mod_timer(&vport->phba->inactive_vmid_poll, 280 280 jiffies + 281 - msecs_to_jiffies(1000 * LPFC_VMID_TIMER)); 281 + secs_to_jiffies(LPFC_VMID_TIMER)); 282 282 vport->phba->pport->vmid_flag |= LPFC_VMID_TIMER_ENBLD; 283 283 } 284 284 }