* [PATCH v3 00/16] Converge on using secs_to_jiffies() part two
@ 2025-02-25 20:17 Easwar Hariharan
2025-02-25 20:17 ` [PATCH v3 01/16] coccinelle: misc: secs_to_jiffies: Patch expressions too Easwar Hariharan
` (19 more replies)
0 siblings, 20 replies; 39+ messages in thread
From: Easwar Hariharan @ 2025-02-25 20:17 UTC (permalink / raw)
To: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky
Cc: cocci, linux-kernel, linux-scsi, dri-devel, linux-sound,
linux-btrfs, ceph-devel, linux-block, linux-ide, linux-xfs,
linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Easwar Hariharan,
Takashi Iwai, Carlos Maiolino
This is the second series (part 1*) that converts users of msecs_to_jiffies() that
either use the multiply pattern of either of:
- msecs_to_jiffies(N*1000) or
- msecs_to_jiffies(N*MSEC_PER_SEC)
where N is a constant or an expression, to avoid the multiplication.
The conversion is made with Coccinelle with the secs_to_jiffies() script
in scripts/coccinelle/misc. Attention is paid to what the best change
can be rather than restricting to what the tool provides.
Andrew has kindly agreed to take the series through mm.git modulo the
patches maintainers want to pick through their own trees.
This series is based on next-20250225
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
* https://lore.kernel.org/all/20241210-converge-secs-to-jiffies-v3-0-ddfefd7e9f2a@linux.microsoft.com/
---
Changes in v3:
- Change commit message prefix from libata: zpodd to ata: libata-zpodd: in patch 8 (Damien)
- Split up overly long line in patch 9 (Christoph)
- Fixup unnecessary line break in patch 14 (Ilpo)
- Combine v1 and v2
- Fix some additional hunks in patch 2 (scsi: lpfc) which the more concise script missed
- msecs_to_jiffies -> msecs_to_jiffies() in commit messages throughout
- Bug in secs_to_jiffies() uncovered by LKP merged in 6.14-rc2: bb2784d9ab4958 ("jiffies: Cast to unsigned long in secs_to_jiffies() conversion")
- Link to v2: https://lore.kernel.org/r/20250203-converge-secs-to-jiffies-part-two-v2-0-d7058a01fd0e@linux.microsoft.com
Changes in v2:
- Remove unneeded range checks in rbd and libceph. While there, convert some timeouts that should have been fixed in part 1. (Ilya)
- Fixup secs_to_jiffies.cocci to be a bit more verbose
- Link to v1: https://lore.kernel.org/r/20250128-converge-secs-to-jiffies-part-two-v1-0-9a6ecf0b2308@linux.microsoft.com
---
Easwar Hariharan (16):
coccinelle: misc: secs_to_jiffies: Patch expressions too
scsi: lpfc: convert timeouts to secs_to_jiffies()
accel/habanalabs: convert timeouts to secs_to_jiffies()
ALSA: ac97: convert timeouts to secs_to_jiffies()
btrfs: convert timeouts to secs_to_jiffies()
rbd: convert timeouts to secs_to_jiffies()
libceph: convert timeouts to secs_to_jiffies()
ata: libata-zpodd: convert timeouts to secs_to_jiffies()
xfs: convert timeouts to secs_to_jiffies()
power: supply: da9030: convert timeouts to secs_to_jiffies()
nvme: convert timeouts to secs_to_jiffies()
spi: spi-fsl-lpspi: convert timeouts to secs_to_jiffies()
spi: spi-imx: convert timeouts to secs_to_jiffies()
platform/x86/amd/pmf: convert timeouts to secs_to_jiffies()
platform/x86: thinkpad_acpi: convert timeouts to secs_to_jiffies()
RDMA/bnxt_re: convert timeouts to secs_to_jiffies()
.../accel/habanalabs/common/command_submission.c | 2 +-
drivers/accel/habanalabs/common/debugfs.c | 2 +-
drivers/accel/habanalabs/common/device.c | 2 +-
drivers/accel/habanalabs/common/habanalabs_drv.c | 2 +-
drivers/ata/libata-zpodd.c | 3 +-
drivers/block/rbd.c | 8 ++---
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 2 +-
drivers/nvme/host/core.c | 6 ++--
drivers/platform/x86/amd/pmf/acpi.c | 2 +-
drivers/platform/x86/thinkpad_acpi.c | 2 +-
drivers/power/supply/da9030_battery.c | 3 +-
drivers/scsi/lpfc/lpfc.h | 3 +-
drivers/scsi/lpfc/lpfc_els.c | 11 +++---
drivers/scsi/lpfc/lpfc_hbadisc.c | 2 +-
drivers/scsi/lpfc/lpfc_init.c | 10 +++---
drivers/scsi/lpfc/lpfc_scsi.c | 12 +++----
drivers/scsi/lpfc/lpfc_sli.c | 41 +++++++++-------------
drivers/scsi/lpfc/lpfc_vport.c | 2 +-
drivers/spi/spi-fsl-lpspi.c | 2 +-
drivers/spi/spi-imx.c | 2 +-
fs/btrfs/disk-io.c | 6 ++--
fs/xfs/xfs_icache.c | 2 +-
fs/xfs/xfs_sysfs.c | 8 ++---
include/linux/ceph/libceph.h | 12 +++----
net/ceph/ceph_common.c | 18 ++++------
net/ceph/osd_client.c | 3 +-
scripts/coccinelle/misc/secs_to_jiffies.cocci | 10 ++++++
sound/pci/ac97/ac97_codec.c | 3 +-
28 files changed, 82 insertions(+), 99 deletions(-)
---
base-commit: 0226d0ce98a477937ed295fb7df4cc30b46fc304
change-id: 20241217-converge-secs-to-jiffies-part-two-f44017aa6f67
Best regards,
--
Easwar Hariharan <eahariha@linux.microsoft.com>
^ permalink raw reply [flat|nested] 39+ messages in thread
* [PATCH v3 01/16] coccinelle: misc: secs_to_jiffies: Patch expressions too
2025-02-25 20:17 [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Easwar Hariharan
@ 2025-02-25 20:17 ` Easwar Hariharan
2025-02-25 20:17 ` [PATCH v3 02/16] scsi: lpfc: convert timeouts to secs_to_jiffies() Easwar Hariharan
` (18 subsequent siblings)
19 siblings, 0 replies; 39+ messages in thread
From: Easwar Hariharan @ 2025-02-25 20:17 UTC (permalink / raw)
To: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky
Cc: cocci, linux-kernel, linux-scsi, dri-devel, linux-sound,
linux-btrfs, ceph-devel, linux-block, linux-ide, linux-xfs,
linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Easwar Hariharan
Teach the script to suggest conversions for timeout patterns where the
arguments to msecs_to_jiffies() are expressions as well.
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
---
scripts/coccinelle/misc/secs_to_jiffies.cocci | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/scripts/coccinelle/misc/secs_to_jiffies.cocci b/scripts/coccinelle/misc/secs_to_jiffies.cocci
index 8bbb2884ea5db939c63fd4513cf5ca8c977aa8cb..416f348174ca659b544441f5f68f04a41d1ad4a3 100644
--- a/scripts/coccinelle/misc/secs_to_jiffies.cocci
+++ b/scripts/coccinelle/misc/secs_to_jiffies.cocci
@@ -20,3 +20,13 @@ virtual patch
- msecs_to_jiffies(C * MSEC_PER_SEC)
+ secs_to_jiffies(C)
+
+@depends on patch@ expression E; @@
+
+- msecs_to_jiffies(E * 1000)
++ secs_to_jiffies(E)
+
+@depends on patch@ expression E; @@
+
+- msecs_to_jiffies(E * MSEC_PER_SEC)
++ secs_to_jiffies(E)
--
2.43.0
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH v3 02/16] scsi: lpfc: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Easwar Hariharan
2025-02-25 20:17 ` [PATCH v3 01/16] coccinelle: misc: secs_to_jiffies: Patch expressions too Easwar Hariharan
@ 2025-02-25 20:17 ` Easwar Hariharan
2025-03-04 2:11 ` Martin K. Petersen
2025-02-25 20:17 ` [PATCH v3 03/16] accel/habanalabs: " Easwar Hariharan
` (17 subsequent siblings)
19 siblings, 1 reply; 39+ messages in thread
From: Easwar Hariharan @ 2025-02-25 20:17 UTC (permalink / raw)
To: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky
Cc: cocci, linux-kernel, linux-scsi, dri-devel, linux-sound,
linux-btrfs, ceph-devel, linux-block, linux-ide, linux-xfs,
linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Easwar Hariharan
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.
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
---
drivers/scsi/lpfc/lpfc.h | 3 +--
drivers/scsi/lpfc/lpfc_els.c | 11 +++++------
drivers/scsi/lpfc/lpfc_hbadisc.c | 2 +-
drivers/scsi/lpfc/lpfc_init.c | 10 +++++-----
drivers/scsi/lpfc/lpfc_scsi.c | 12 +++++-------
drivers/scsi/lpfc/lpfc_sli.c | 41 ++++++++++++++++------------------------
drivers/scsi/lpfc/lpfc_vport.c | 2 +-
7 files changed, 34 insertions(+), 47 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index 62438e84e52a3bf93aff6adf6c6fbbb61e3f1e3f..fe4fb67eb50c9b773d0fc0066b705024513faea4 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -74,8 +74,7 @@ struct lpfc_sli2_slim;
* queue depths when there are driver resource error or Firmware
* resource error.
*/
-/* 1 Second */
-#define QUEUE_RAMP_DOWN_INTERVAL (msecs_to_jiffies(1000 * 1))
+#define QUEUE_RAMP_DOWN_INTERVAL (secs_to_jiffies(1))
/* Number of exchanges reserved for discovery to complete */
#define LPFC_DISC_IOCB_BUFF_COUNT 20
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 9ab2e98cf69336c8f6a0ceca3870cbecb6c77ef2..e08b48b1b655c2e145b30261bbdcb9a57d40e19e 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -8045,8 +8045,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
if (test_bit(FC_DISC_TMO, &vport->fc_flag)) {
tmo = ((phba->fc_ratov * 3) + 3);
mod_timer(&vport->fc_disctmo,
- jiffies +
- msecs_to_jiffies(1000 * tmo));
+ jiffies + secs_to_jiffies(tmo));
}
return 0;
}
@@ -8081,7 +8080,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
if (test_bit(FC_DISC_TMO, &vport->fc_flag)) {
tmo = ((phba->fc_ratov * 3) + 3);
mod_timer(&vport->fc_disctmo,
- jiffies + msecs_to_jiffies(1000 * tmo));
+ jiffies + secs_to_jiffies(tmo));
}
if ((rscn_cnt < FC_MAX_HOLD_RSCN) &&
!test_bit(FC_RSCN_DISCOVERY, &vport->fc_flag)) {
@@ -9511,7 +9510,7 @@ lpfc_els_timeout_handler(struct lpfc_vport *vport)
if (!list_empty(&pring->txcmplq))
if (!test_bit(FC_UNLOADING, &phba->pport->load_flag))
mod_timer(&vport->els_tmofunc,
- jiffies + msecs_to_jiffies(1000 * timeout));
+ jiffies + secs_to_jiffies(timeout));
}
/**
@@ -10897,7 +10896,7 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport)
"3334 Delay fc port discovery for %d secs\n",
phba->fc_ratov);
mod_timer(&vport->delayed_disc_tmo,
- jiffies + msecs_to_jiffies(1000 * phba->fc_ratov));
+ jiffies + secs_to_jiffies(phba->fc_ratov));
return;
}
@@ -11154,7 +11153,7 @@ lpfc_retry_pport_discovery(struct lpfc_hba *phba)
if (!ndlp)
return;
- mod_timer(&ndlp->nlp_delayfunc, jiffies + msecs_to_jiffies(1000));
+ mod_timer(&ndlp->nlp_delayfunc, jiffies + secs_to_jiffies(1));
set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag);
ndlp->nlp_last_elscmd = ELS_CMD_FLOGI;
phba->pport->port_state = LPFC_FLOGI;
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index a2fd74cf86036ef134ec6959c90aada8a0218294..18c0365ca30563530189ca5eda7b9c8901398c82 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -4979,7 +4979,7 @@ lpfc_set_disctmo(struct lpfc_vport *vport)
tmo, vport->port_state, vport->fc_flag);
}
- mod_timer(&vport->fc_disctmo, jiffies + msecs_to_jiffies(1000 * tmo));
+ mod_timer(&vport->fc_disctmo, jiffies + secs_to_jiffies(tmo));
set_bit(FC_DISC_TMO, &vport->fc_flag);
/* Start Discovery Timer state <hba_state> */
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index e1add109017b95fc87d024beb477ee424ea39df4..7238608ca49f9bcfc4d43acd6f400b12f2865589 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -595,7 +595,7 @@ lpfc_config_port_post(struct lpfc_hba *phba)
/* Set up ring-0 (ELS) timer */
timeout = phba->fc_ratov * 2;
mod_timer(&vport->els_tmofunc,
- jiffies + msecs_to_jiffies(1000 * timeout));
+ jiffies + secs_to_jiffies(timeout));
/* Set up heart beat (HB) timer */
mod_timer(&phba->hb_tmofunc,
jiffies + secs_to_jiffies(LPFC_HB_MBOX_INTERVAL));
@@ -604,7 +604,7 @@ lpfc_config_port_post(struct lpfc_hba *phba)
phba->last_completion_time = jiffies;
/* Set up error attention (ERATT) polling timer */
mod_timer(&phba->eratt_poll,
- jiffies + msecs_to_jiffies(1000 * phba->eratt_poll_interval));
+ jiffies + secs_to_jiffies(phba->eratt_poll_interval));
if (test_bit(LINK_DISABLED, &phba->hba_flag)) {
lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
@@ -3361,8 +3361,8 @@ lpfc_block_mgmt_io(struct lpfc_hba *phba, int mbx_action)
/* Determine how long we might wait for the active mailbox
* command to be gracefully completed by firmware.
*/
- timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba,
- phba->sli.mbox_active) * 1000) + jiffies;
+ timeout = secs_to_jiffies(lpfc_mbox_tmo_val(phba,
+ phba->sli.mbox_active)) + jiffies;
}
spin_unlock_irqrestore(&phba->hbalock, iflag);
@@ -6909,7 +6909,7 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,
* re-instantiate the Vlink using FDISC.
*/
mod_timer(&ndlp->nlp_delayfunc,
- jiffies + msecs_to_jiffies(1000));
+ jiffies + secs_to_jiffies(1));
set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag);
ndlp->nlp_last_elscmd = ELS_CMD_FDISC;
vport->port_state = LPFC_FDISC;
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 055ed632c14df51376126a285df728269ca1da6c..f0158fc00f783239db615b0978b6785de064535f 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -5645,9 +5645,8 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd)
* cmd_flag is set to LPFC_DRIVER_ABORTED before we wait
* for abort to complete.
*/
- wait_event_timeout(waitq,
- (lpfc_cmd->pCmd != cmnd),
- msecs_to_jiffies(2*vport->cfg_devloss_tmo*1000));
+ wait_event_timeout(waitq, (lpfc_cmd->pCmd != cmnd),
+ secs_to_jiffies(2*vport->cfg_devloss_tmo));
spin_lock(&lpfc_cmd->buf_lock);
@@ -5911,7 +5910,7 @@ lpfc_chk_tgt_mapped(struct lpfc_vport *vport, struct fc_rport *rport)
* If target is not in a MAPPED state, delay until
* target is rediscovered or devloss timeout expires.
*/
- later = msecs_to_jiffies(2 * vport->cfg_devloss_tmo * 1000) + jiffies;
+ later = secs_to_jiffies(2 * vport->cfg_devloss_tmo) + jiffies;
while (time_after(later, jiffies)) {
if (!pnode)
return FAILED;
@@ -5957,7 +5956,7 @@ lpfc_reset_flush_io_context(struct lpfc_vport *vport, uint16_t tgt_id,
lpfc_sli_abort_taskmgmt(vport,
&phba->sli.sli3_ring[LPFC_FCP_RING],
tgt_id, lun_id, context);
- later = msecs_to_jiffies(2 * vport->cfg_devloss_tmo * 1000) + jiffies;
+ later = secs_to_jiffies(2 * vport->cfg_devloss_tmo) + jiffies;
while (time_after(later, jiffies) && cnt) {
schedule_timeout_uninterruptible(msecs_to_jiffies(20));
cnt = lpfc_sli_sum_iocb(vport, tgt_id, lun_id, context);
@@ -6137,8 +6136,7 @@ lpfc_target_reset_handler(struct scsi_cmnd *cmnd)
wait_event_timeout(waitq,
!test_bit(NLP_WAIT_FOR_LOGO,
&pnode->save_flags),
- msecs_to_jiffies(dev_loss_tmo *
- 1000));
+ secs_to_jiffies(dev_loss_tmo));
if (test_and_clear_bit(NLP_WAIT_FOR_LOGO,
&pnode->save_flags))
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 3fd9723cd271c8a024b6f34e583668e973404e6f..531fd47cda5ca6985bfb510c44888ed6d7121853 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -1025,7 +1025,7 @@ lpfc_handle_rrq_active(struct lpfc_hba *phba)
LIST_HEAD(send_rrq);
clear_bit(HBA_RRQ_ACTIVE, &phba->hba_flag);
- next_time = jiffies + msecs_to_jiffies(1000 * (phba->fc_ratov + 1));
+ next_time = jiffies + secs_to_jiffies(phba->fc_ratov + 1);
spin_lock_irqsave(&phba->rrq_list_lock, iflags);
list_for_each_entry_safe(rrq, nextrrq,
&phba->active_rrq_list, list) {
@@ -1208,8 +1208,7 @@ lpfc_set_rrq_active(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp,
else
rrq->send_rrq = 0;
rrq->xritag = xritag;
- rrq->rrq_stop_time = jiffies +
- msecs_to_jiffies(1000 * (phba->fc_ratov + 1));
+ rrq->rrq_stop_time = jiffies + secs_to_jiffies(phba->fc_ratov + 1);
rrq->nlp_DID = ndlp->nlp_DID;
rrq->vport = ndlp->vport;
rrq->rxid = rxid;
@@ -1736,8 +1735,7 @@ lpfc_sli_ringtxcmpl_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
BUG_ON(!piocb->vport);
if (!test_bit(FC_UNLOADING, &piocb->vport->load_flag))
mod_timer(&piocb->vport->els_tmofunc,
- jiffies +
- msecs_to_jiffies(1000 * (phba->fc_ratov << 1)));
+ jiffies + secs_to_jiffies(phba->fc_ratov << 1));
}
return 0;
@@ -3956,8 +3954,7 @@ void lpfc_poll_eratt(struct timer_list *t)
else
/* Restart the timer for next eratt poll */
mod_timer(&phba->eratt_poll,
- jiffies +
- msecs_to_jiffies(1000 * phba->eratt_poll_interval));
+ jiffies + secs_to_jiffies(phba->eratt_poll_interval);
return;
}
@@ -9008,7 +9005,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
/* Start the ELS watchdog timer */
mod_timer(&vport->els_tmofunc,
- jiffies + msecs_to_jiffies(1000 * (phba->fc_ratov * 2)));
+ jiffies + secs_to_jiffies(phba->fc_ratov * 2));
/* Start heart beat timer */
mod_timer(&phba->hb_tmofunc,
@@ -9027,7 +9024,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
/* Start error attention (ERATT) polling timer */
mod_timer(&phba->eratt_poll,
- jiffies + msecs_to_jiffies(1000 * phba->eratt_poll_interval));
+ jiffies + secs_to_jiffies(phba->eratt_poll_interval));
/*
* The port is ready, set the host's link state to LINK_DOWN
@@ -9504,8 +9501,7 @@ lpfc_sli_issue_mbox_s3(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox,
goto out_not_finished;
}
/* timeout active mbox command */
- timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, pmbox) *
- 1000);
+ timeout = secs_to_jiffies(lpfc_mbox_tmo_val(phba, pmbox));
mod_timer(&psli->mbox_tmo, jiffies + timeout);
}
@@ -9629,8 +9625,7 @@ lpfc_sli_issue_mbox_s3(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox,
drvr_flag);
goto out_not_finished;
}
- timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, pmbox) *
- 1000) + jiffies;
+ timeout = secs_to_jiffies(lpfc_mbox_tmo_val(phba, pmbox)) + jiffies;
i = 0;
/* Wait for command to complete */
while (((word0 & OWN_CHIP) == OWN_CHIP) ||
@@ -9756,9 +9751,8 @@ lpfc_sli4_async_mbox_block(struct lpfc_hba *phba)
* command to be gracefully completed by firmware.
*/
if (phba->sli.mbox_active)
- timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba,
- phba->sli.mbox_active) *
- 1000) + jiffies;
+ timeout = secs_to_jiffies(lpfc_mbox_tmo_val(phba,
+ phba->sli.mbox_active)) + jiffies;
spin_unlock_irq(&phba->hbalock);
/* Make sure the mailbox is really active */
@@ -9881,8 +9875,7 @@ lpfc_sli4_wait_bmbx_ready(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
}
}
- timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, mboxq)
- * 1000) + jiffies;
+ timeout = secs_to_jiffies(lpfc_mbox_tmo_val(phba, mboxq)) + jiffies;
do {
bmbx_reg.word0 = readl(phba->sli4_hba.BMBXregaddr);
@@ -10230,7 +10223,7 @@ lpfc_sli4_post_async_mbox(struct lpfc_hba *phba)
/* Start timer for the mbox_tmo and log some mailbox post messages */
mod_timer(&psli->mbox_tmo, (jiffies +
- msecs_to_jiffies(1000 * lpfc_mbox_tmo_val(phba, mboxq))));
+ secs_to_jiffies(lpfc_mbox_tmo_val(phba, mboxq))));
lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI,
"(%d):0355 Mailbox cmd x%x (x%x/x%x) issue Data: "
@@ -13159,7 +13152,7 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba *phba,
retval = lpfc_sli_issue_iocb(phba, ring_number, piocb,
SLI_IOCB_RET_IOCB);
if (retval == IOCB_SUCCESS) {
- timeout_req = msecs_to_jiffies(timeout * 1000);
+ timeout_req = secs_to_jiffies(timeout);
timeleft = wait_event_timeout(done_q,
lpfc_chk_iocb_flg(phba, piocb, LPFC_IO_WAKE),
timeout_req);
@@ -13275,8 +13268,7 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq,
/* now issue the command */
retval = lpfc_sli_issue_mbox(phba, pmboxq, MBX_NOWAIT);
if (retval == MBX_BUSY || retval == MBX_SUCCESS) {
- wait_for_completion_timeout(&mbox_done,
- msecs_to_jiffies(timeout * 1000));
+ wait_for_completion_timeout(&mbox_done, secs_to_jiffies(timeout));
spin_lock_irqsave(&phba->hbalock, flag);
pmboxq->ctx_u.mbox_wait = NULL;
@@ -13336,9 +13328,8 @@ lpfc_sli_mbox_sys_shutdown(struct lpfc_hba *phba, int mbx_action)
* command to be gracefully completed by firmware.
*/
if (phba->sli.mbox_active)
- timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba,
- phba->sli.mbox_active) *
- 1000) + jiffies;
+ timeout = secs_to_jiffies(lpfc_mbox_tmo_val(phba,
+ phba->sli.mbox_active)) + jiffies;
spin_unlock_irq(&phba->hbalock);
/* Enable softirqs again, done with phba->hbalock */
diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c
index 3d70cc5175730b31eeaf46c89d65c0dc09367d44..cc56a73343195a263c307fab6870a0012899060a 100644
--- a/drivers/scsi/lpfc/lpfc_vport.c
+++ b/drivers/scsi/lpfc/lpfc_vport.c
@@ -246,7 +246,7 @@ static void lpfc_discovery_wait(struct lpfc_vport *vport)
* fabric RA_TOV value and dev_loss tmo. The driver's
* devloss_tmo is 10 giving this loop a 3x multiplier minimally.
*/
- wait_time_max = msecs_to_jiffies(((phba->fc_ratov * 3) + 3) * 1000);
+ wait_time_max = secs_to_jiffies((phba->fc_ratov * 3) + 3);
wait_time_max += jiffies;
start_time = jiffies;
while (time_before(jiffies, wait_time_max)) {
--
2.43.0
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH v3 03/16] accel/habanalabs: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Easwar Hariharan
2025-02-25 20:17 ` [PATCH v3 01/16] coccinelle: misc: secs_to_jiffies: Patch expressions too Easwar Hariharan
2025-02-25 20:17 ` [PATCH v3 02/16] scsi: lpfc: convert timeouts to secs_to_jiffies() Easwar Hariharan
@ 2025-02-25 20:17 ` Easwar Hariharan
2025-02-25 20:17 ` [PATCH v3 04/16] ALSA: ac97: " Easwar Hariharan
` (16 subsequent siblings)
19 siblings, 0 replies; 39+ messages in thread
From: Easwar Hariharan @ 2025-02-25 20:17 UTC (permalink / raw)
To: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky
Cc: cocci, linux-kernel, linux-scsi, dri-devel, linux-sound,
linux-btrfs, ceph-devel, linux-block, linux-ide, linux-xfs,
linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Easwar Hariharan
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
+secs_to_jiffies
(E
- * \( 1000 \| MSEC_PER_SEC \)
)
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
---
drivers/accel/habanalabs/common/command_submission.c | 2 +-
drivers/accel/habanalabs/common/debugfs.c | 2 +-
drivers/accel/habanalabs/common/device.c | 2 +-
drivers/accel/habanalabs/common/habanalabs_drv.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/accel/habanalabs/common/command_submission.c b/drivers/accel/habanalabs/common/command_submission.c
index 59823e3c3bf7a4fafc0b112fd7b4b2209149973c..dee487724918554c24c3e78df4e8715dd1c73acd 100644
--- a/drivers/accel/habanalabs/common/command_submission.c
+++ b/drivers/accel/habanalabs/common/command_submission.c
@@ -2586,7 +2586,7 @@ int hl_cs_ioctl(struct drm_device *ddev, void *data, struct drm_file *file_priv)
cs_seq = args->in.seq;
timeout = flags & HL_CS_FLAGS_CUSTOM_TIMEOUT
- ? msecs_to_jiffies(args->in.timeout * 1000)
+ ? secs_to_jiffies(args->in.timeout)
: hpriv->hdev->timeout_jiffies;
switch (cs_type) {
diff --git a/drivers/accel/habanalabs/common/debugfs.c b/drivers/accel/habanalabs/common/debugfs.c
index ca7677293a55822f703a3a1cbf947c4c44fdc569..4b391807e5f2e2a2570a38b9dfdf6be4299dbfb6 100644
--- a/drivers/accel/habanalabs/common/debugfs.c
+++ b/drivers/accel/habanalabs/common/debugfs.c
@@ -1403,7 +1403,7 @@ static ssize_t hl_timeout_locked_write(struct file *f, const char __user *buf,
return rc;
if (value)
- hdev->timeout_jiffies = msecs_to_jiffies(value * 1000);
+ hdev->timeout_jiffies = secs_to_jiffies(value);
else
hdev->timeout_jiffies = MAX_SCHEDULE_TIMEOUT;
diff --git a/drivers/accel/habanalabs/common/device.c b/drivers/accel/habanalabs/common/device.c
index 30277ae410d4b742ffb7bddc35498564ff96fe62..68eebed3b050f72f81e55b86da869b56b4cdeadf 100644
--- a/drivers/accel/habanalabs/common/device.c
+++ b/drivers/accel/habanalabs/common/device.c
@@ -2091,7 +2091,7 @@ int hl_device_cond_reset(struct hl_device *hdev, u32 flags, u64 event_mask)
dev_dbg(hdev->dev, "Device is going to be hard-reset in %u sec unless being released\n",
hdev->device_release_watchdog_timeout_sec);
schedule_delayed_work(&hdev->device_release_watchdog_work.reset_work,
- msecs_to_jiffies(hdev->device_release_watchdog_timeout_sec * 1000));
+ secs_to_jiffies(hdev->device_release_watchdog_timeout_sec));
hdev->reset_info.watchdog_active = 1;
out:
spin_unlock(&hdev->reset_info.lock);
diff --git a/drivers/accel/habanalabs/common/habanalabs_drv.c b/drivers/accel/habanalabs/common/habanalabs_drv.c
index 596c52e8aa266bf48e2be45e719adb202604577b..0035748f3228246da235f227b2cf3939d64af350 100644
--- a/drivers/accel/habanalabs/common/habanalabs_drv.c
+++ b/drivers/accel/habanalabs/common/habanalabs_drv.c
@@ -386,7 +386,7 @@ static int fixup_device_params(struct hl_device *hdev)
hdev->fw_comms_poll_interval_usec = HL_FW_STATUS_POLL_INTERVAL_USEC;
if (tmp_timeout)
- hdev->timeout_jiffies = msecs_to_jiffies(tmp_timeout * MSEC_PER_SEC);
+ hdev->timeout_jiffies = secs_to_jiffies(tmp_timeout);
else
hdev->timeout_jiffies = MAX_SCHEDULE_TIMEOUT;
--
2.43.0
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH v3 04/16] ALSA: ac97: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Easwar Hariharan
` (2 preceding siblings ...)
2025-02-25 20:17 ` [PATCH v3 03/16] accel/habanalabs: " Easwar Hariharan
@ 2025-02-25 20:17 ` Easwar Hariharan
2025-02-26 11:55 ` [cocci] " Markus Elfring
2025-02-25 20:17 ` [PATCH v3 05/16] btrfs: " Easwar Hariharan
` (15 subsequent siblings)
19 siblings, 1 reply; 39+ messages in thread
From: Easwar Hariharan @ 2025-02-25 20:17 UTC (permalink / raw)
To: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky
Cc: cocci, linux-kernel, linux-scsi, dri-devel, linux-sound,
linux-btrfs, ceph-devel, linux-block, linux-ide, linux-xfs,
linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Easwar Hariharan,
Takashi Iwai
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
+secs_to_jiffies
(E
- * \( 1000 \| MSEC_PER_SEC \)
)
Acked-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
---
sound/pci/ac97/ac97_codec.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index 6e710dce5c6068ec20c2da751b6f5372ad1df211..88ac37739b7653f69af430dd0163f5ab4ddf0d0c 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -2461,8 +2461,7 @@ int snd_ac97_update_power(struct snd_ac97 *ac97, int reg, int powerup)
* (for avoiding loud click noises for many (OSS) apps
* that open/close frequently)
*/
- schedule_delayed_work(&ac97->power_work,
- msecs_to_jiffies(power_save * 1000));
+ schedule_delayed_work(&ac97->power_work, secs_to_jiffies(power_save));
else {
cancel_delayed_work(&ac97->power_work);
update_power_regs(ac97);
--
2.43.0
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH v3 05/16] btrfs: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Easwar Hariharan
` (3 preceding siblings ...)
2025-02-25 20:17 ` [PATCH v3 04/16] ALSA: ac97: " Easwar Hariharan
@ 2025-02-25 20:17 ` Easwar Hariharan
2025-02-25 20:17 ` [PATCH v3 06/16] rbd: " Easwar Hariharan
` (14 subsequent siblings)
19 siblings, 0 replies; 39+ messages in thread
From: Easwar Hariharan @ 2025-02-25 20:17 UTC (permalink / raw)
To: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky
Cc: cocci, linux-kernel, linux-scsi, dri-devel, linux-sound,
linux-btrfs, ceph-devel, linux-block, linux-ide, linux-xfs,
linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Easwar Hariharan
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
+secs_to_jiffies
(E
- * \( 1000 \| MSEC_PER_SEC \)
)
Acked-by: David Sterba <dsterba@suse.com>
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
---
fs/btrfs/disk-io.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index c0b40dedceb53d6f1452b4dafea6b76eac08b932..606b004001bd8720f2aef059d435afb2d7b975d1 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1567,7 +1567,7 @@ static int transaction_kthread(void *arg)
do {
cannot_commit = false;
- delay = msecs_to_jiffies(fs_info->commit_interval * 1000);
+ delay = secs_to_jiffies(fs_info->commit_interval);
mutex_lock(&fs_info->transaction_kthread_mutex);
spin_lock(&fs_info->trans_lock);
@@ -1582,9 +1582,9 @@ static int transaction_kthread(void *arg)
cur->state < TRANS_STATE_COMMIT_PREP &&
delta < fs_info->commit_interval) {
spin_unlock(&fs_info->trans_lock);
- delay -= msecs_to_jiffies((delta - 1) * 1000);
+ delay -= secs_to_jiffies(delta - 1);
delay = min(delay,
- msecs_to_jiffies(fs_info->commit_interval * 1000));
+ secs_to_jiffies(fs_info->commit_interval));
goto sleep;
}
transid = cur->transid;
--
2.43.0
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH v3 06/16] rbd: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Easwar Hariharan
` (4 preceding siblings ...)
2025-02-25 20:17 ` [PATCH v3 05/16] btrfs: " Easwar Hariharan
@ 2025-02-25 20:17 ` Easwar Hariharan
2025-02-25 21:09 ` Christophe JAILLET
2025-02-25 20:17 ` [PATCH v3 07/16] libceph: " Easwar Hariharan
` (13 subsequent siblings)
19 siblings, 1 reply; 39+ messages in thread
From: Easwar Hariharan @ 2025-02-25 20:17 UTC (permalink / raw)
To: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky
Cc: cocci, linux-kernel, linux-scsi, dri-devel, linux-sound,
linux-btrfs, ceph-devel, linux-block, linux-ide, linux-xfs,
linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Easwar Hariharan
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)
@depends on patch@ expression E; @@
-msecs_to_jiffies(E * MSEC_PER_SEC)
+secs_to_jiffies(E)
While here, remove the no-longer necessary check for range since there's
no multiplication involved.
Acked-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
---
drivers/block/rbd.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index faafd7ff43d6ef53110ab3663cc7ac322214cc8c..41207133e21e9203192adf3b92390818e8fa5a58 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -108,7 +108,7 @@ static int atomic_dec_return_safe(atomic_t *v)
#define RBD_OBJ_PREFIX_LEN_MAX 64
#define RBD_NOTIFY_TIMEOUT 5 /* seconds */
-#define RBD_RETRY_DELAY msecs_to_jiffies(1000)
+#define RBD_RETRY_DELAY secs_to_jiffies(1)
/* Feature bits */
@@ -4162,7 +4162,7 @@ static void rbd_acquire_lock(struct work_struct *work)
dout("%s rbd_dev %p requeuing lock_dwork\n", __func__,
rbd_dev);
mod_delayed_work(rbd_dev->task_wq, &rbd_dev->lock_dwork,
- msecs_to_jiffies(2 * RBD_NOTIFY_TIMEOUT * MSEC_PER_SEC));
+ secs_to_jiffies(2 * RBD_NOTIFY_TIMEOUT));
}
}
@@ -6283,9 +6283,7 @@ static int rbd_parse_param(struct fs_parameter *param,
break;
case Opt_lock_timeout:
/* 0 is "wait forever" (i.e. infinite timeout) */
- if (result.uint_32 > INT_MAX / 1000)
- goto out_of_range;
- opt->lock_timeout = msecs_to_jiffies(result.uint_32 * 1000);
+ opt->lock_timeout = secs_to_jiffies(result.uint_32);
break;
case Opt_pool_ns:
kfree(pctx->spec->pool_ns);
--
2.43.0
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH v3 07/16] libceph: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Easwar Hariharan
` (5 preceding siblings ...)
2025-02-25 20:17 ` [PATCH v3 06/16] rbd: " Easwar Hariharan
@ 2025-02-25 20:17 ` Easwar Hariharan
2025-02-25 21:25 ` Christophe JAILLET
2025-02-25 20:17 ` [PATCH v3 08/16] ata: libata-zpodd: " Easwar Hariharan
` (12 subsequent siblings)
19 siblings, 1 reply; 39+ messages in thread
From: Easwar Hariharan @ 2025-02-25 20:17 UTC (permalink / raw)
To: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky
Cc: cocci, linux-kernel, linux-scsi, dri-devel, linux-sound,
linux-btrfs, ceph-devel, linux-block, linux-ide, linux-xfs,
linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Easwar Hariharan
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)
@depends on patch@ expression E; @@
-msecs_to_jiffies(E * MSEC_PER_SEC)
+secs_to_jiffies(E)
While here, remove the no-longer necessary checks for range since there's
no multiplication involved.
Acked-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
---
include/linux/ceph/libceph.h | 12 ++++++------
net/ceph/ceph_common.c | 18 ++++++------------
net/ceph/osd_client.c | 3 +--
3 files changed, 13 insertions(+), 20 deletions(-)
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 733e7f93db66a7a29a4a8eba97e9ebf2c49da1f9..5f57128ef0c7d018341c15cc59288aa47edec646 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -72,15 +72,15 @@ struct ceph_options {
/*
* defaults
*/
-#define CEPH_MOUNT_TIMEOUT_DEFAULT msecs_to_jiffies(60 * 1000)
-#define CEPH_OSD_KEEPALIVE_DEFAULT msecs_to_jiffies(5 * 1000)
-#define CEPH_OSD_IDLE_TTL_DEFAULT msecs_to_jiffies(60 * 1000)
+#define CEPH_MOUNT_TIMEOUT_DEFAULT secs_to_jiffies(60)
+#define CEPH_OSD_KEEPALIVE_DEFAULT secs_to_jiffies(5)
+#define CEPH_OSD_IDLE_TTL_DEFAULT secs_to_jiffies(60)
#define CEPH_OSD_REQUEST_TIMEOUT_DEFAULT 0 /* no timeout */
#define CEPH_READ_FROM_REPLICA_DEFAULT 0 /* read from primary */
-#define CEPH_MONC_HUNT_INTERVAL msecs_to_jiffies(3 * 1000)
-#define CEPH_MONC_PING_INTERVAL msecs_to_jiffies(10 * 1000)
-#define CEPH_MONC_PING_TIMEOUT msecs_to_jiffies(30 * 1000)
+#define CEPH_MONC_HUNT_INTERVAL secs_to_jiffies(3)
+#define CEPH_MONC_PING_INTERVAL secs_to_jiffies(10)
+#define CEPH_MONC_PING_TIMEOUT secs_to_jiffies(30)
#define CEPH_MONC_HUNT_BACKOFF 2
#define CEPH_MONC_HUNT_MAX_MULT 10
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
index 4c6441536d55b6323f4b9d93b5d4837cd4ec880c..c2a2c3bcc4e91a628c99bd1cef1211d54389efa2 100644
--- a/net/ceph/ceph_common.c
+++ b/net/ceph/ceph_common.c
@@ -527,29 +527,23 @@ int ceph_parse_param(struct fs_parameter *param, struct ceph_options *opt,
case Opt_osdkeepalivetimeout:
/* 0 isn't well defined right now, reject it */
- if (result.uint_32 < 1 || result.uint_32 > INT_MAX / 1000)
+ if (result.uint_32 < 1)
goto out_of_range;
- opt->osd_keepalive_timeout =
- msecs_to_jiffies(result.uint_32 * 1000);
+ opt->osd_keepalive_timeout = secs_to_jiffies(result.uint_32);
break;
case Opt_osd_idle_ttl:
/* 0 isn't well defined right now, reject it */
- if (result.uint_32 < 1 || result.uint_32 > INT_MAX / 1000)
+ if (result.uint_32 < 1)
goto out_of_range;
- opt->osd_idle_ttl = msecs_to_jiffies(result.uint_32 * 1000);
+ opt->osd_idle_ttl = secs_to_jiffies(result.uint_32);
break;
case Opt_mount_timeout:
/* 0 is "wait forever" (i.e. infinite timeout) */
- if (result.uint_32 > INT_MAX / 1000)
- goto out_of_range;
- opt->mount_timeout = msecs_to_jiffies(result.uint_32 * 1000);
+ opt->mount_timeout = secs_to_jiffies(result.uint_32);
break;
case Opt_osd_request_timeout:
/* 0 is "wait forever" (i.e. infinite timeout) */
- if (result.uint_32 > INT_MAX / 1000)
- goto out_of_range;
- opt->osd_request_timeout =
- msecs_to_jiffies(result.uint_32 * 1000);
+ opt->osd_request_timeout = secs_to_jiffies(result.uint_32);
break;
case Opt_share:
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index b24afec241382b60d775dd12a6561fa23a7eca45..ba61a48b4388c2eceb5b7a299906e7f90191dd5d 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -4989,8 +4989,7 @@ int ceph_osdc_notify(struct ceph_osd_client *osdc,
linger_submit(lreq);
ret = linger_reg_commit_wait(lreq);
if (!ret)
- ret = linger_notify_finish_wait(lreq,
- msecs_to_jiffies(2 * timeout * MSEC_PER_SEC));
+ ret = linger_notify_finish_wait(lreq, secs_to_jiffies(2 * timeout));
else
dout("lreq %p failed to initiate notify %d\n", lreq, ret);
--
2.43.0
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH v3 08/16] ata: libata-zpodd: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Easwar Hariharan
` (6 preceding siblings ...)
2025-02-25 20:17 ` [PATCH v3 07/16] libceph: " Easwar Hariharan
@ 2025-02-25 20:17 ` Easwar Hariharan
2025-02-25 20:24 ` Easwar Hariharan
2025-02-25 20:17 ` [PATCH v3 09/16] xfs: " Easwar Hariharan
` (11 subsequent siblings)
19 siblings, 1 reply; 39+ messages in thread
From: Easwar Hariharan @ 2025-02-25 20:17 UTC (permalink / raw)
To: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky
Cc: cocci, linux-kernel, linux-scsi, dri-devel, linux-sound,
linux-btrfs, ceph-devel, linux-block, linux-ide, linux-xfs,
linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Easwar Hariharan
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
+secs_to_jiffies
(E
- * \( 1000 \| MSEC_PER_SEC \)
)
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
---
drivers/ata/libata-zpodd.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/ata/libata-zpodd.c b/drivers/ata/libata-zpodd.c
index 4b83b517caec66c82b126666f6dffd09729bf845..799531218ea2d5cc1b7e693a2b2aff7f376f7d76 100644
--- a/drivers/ata/libata-zpodd.c
+++ b/drivers/ata/libata-zpodd.c
@@ -160,8 +160,7 @@ void zpodd_on_suspend(struct ata_device *dev)
return;
}
- expires = zpodd->last_ready +
- msecs_to_jiffies(zpodd_poweroff_delay * 1000);
+ expires = zpodd->last_ready + secs_to_jiffies(zpodd_poweroff_delay);
if (time_before(jiffies, expires))
return;
--
2.43.0
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH v3 09/16] xfs: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Easwar Hariharan
` (7 preceding siblings ...)
2025-02-25 20:17 ` [PATCH v3 08/16] ata: libata-zpodd: " Easwar Hariharan
@ 2025-02-25 20:17 ` Easwar Hariharan
2025-02-25 20:17 ` [PATCH v3 10/16] power: supply: da9030: " Easwar Hariharan
` (10 subsequent siblings)
19 siblings, 0 replies; 39+ messages in thread
From: Easwar Hariharan @ 2025-02-25 20:17 UTC (permalink / raw)
To: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky
Cc: cocci, linux-kernel, linux-scsi, dri-devel, linux-sound,
linux-btrfs, ceph-devel, linux-block, linux-ide, linux-xfs,
linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Easwar Hariharan,
Carlos Maiolino
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
+secs_to_jiffies
(E
- * \( 1000 \| MSEC_PER_SEC \)
)
Acked-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
---
fs/xfs/xfs_icache.c | 2 +-
fs/xfs/xfs_sysfs.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index 7b6c026d01a1fc020a41a678964cdbf7a8113323..7a1feb8dc21f6f71d04f88de866e5a95925e0c54 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -230,7 +230,7 @@ xfs_blockgc_queue(
rcu_read_lock();
if (radix_tree_tagged(&pag->pag_ici_root, XFS_ICI_BLOCKGC_TAG))
queue_delayed_work(mp->m_blockgc_wq, &pag->pag_blockgc_work,
- msecs_to_jiffies(xfs_blockgc_secs * 1000));
+ secs_to_jiffies(xfs_blockgc_secs));
rcu_read_unlock();
}
diff --git a/fs/xfs/xfs_sysfs.c b/fs/xfs/xfs_sysfs.c
index 60cb5318fdae3cc246236fd988b4749df57f8bfc..c9ca8cd8a2f2785841e3eba2f8e070e45d10b79a 100644
--- a/fs/xfs/xfs_sysfs.c
+++ b/fs/xfs/xfs_sysfs.c
@@ -568,8 +568,8 @@ retry_timeout_seconds_store(
if (val == -1)
cfg->retry_timeout = XFS_ERR_RETRY_FOREVER;
else {
- cfg->retry_timeout = msecs_to_jiffies(val * MSEC_PER_SEC);
- ASSERT(msecs_to_jiffies(val * MSEC_PER_SEC) < LONG_MAX);
+ cfg->retry_timeout = secs_to_jiffies(val);
+ ASSERT(secs_to_jiffies(val) < LONG_MAX);
}
return count;
}
@@ -686,8 +686,8 @@ xfs_error_sysfs_init_class(
if (init[i].retry_timeout == XFS_ERR_RETRY_FOREVER)
cfg->retry_timeout = XFS_ERR_RETRY_FOREVER;
else
- cfg->retry_timeout = msecs_to_jiffies(
- init[i].retry_timeout * MSEC_PER_SEC);
+ cfg->retry_timeout =
+ secs_to_jiffies(init[i].retry_timeout);
}
return 0;
--
2.43.0
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH v3 10/16] power: supply: da9030: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Easwar Hariharan
` (8 preceding siblings ...)
2025-02-25 20:17 ` [PATCH v3 09/16] xfs: " Easwar Hariharan
@ 2025-02-25 20:17 ` Easwar Hariharan
2025-02-25 20:17 ` [PATCH v3 11/16] nvme: " Easwar Hariharan
` (9 subsequent siblings)
19 siblings, 0 replies; 39+ messages in thread
From: Easwar Hariharan @ 2025-02-25 20:17 UTC (permalink / raw)
To: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky
Cc: cocci, linux-kernel, linux-scsi, dri-devel, linux-sound,
linux-btrfs, ceph-devel, linux-block, linux-ide, linux-xfs,
linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Easwar Hariharan
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
+secs_to_jiffies
(E
- * \( 1000 \| MSEC_PER_SEC \)
)
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
---
drivers/power/supply/da9030_battery.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/power/supply/da9030_battery.c b/drivers/power/supply/da9030_battery.c
index ac2e319e95179039279dacaed1744136f679fbac..d25279c260308b6c82acb2aabf44f3749f71b703 100644
--- a/drivers/power/supply/da9030_battery.c
+++ b/drivers/power/supply/da9030_battery.c
@@ -502,8 +502,7 @@ static int da9030_battery_probe(struct platform_device *pdev)
/* 10 seconds between monitor runs unless platform defines other
interval */
- charger->interval = msecs_to_jiffies(
- (pdata->batmon_interval ? : 10) * 1000);
+ charger->interval = secs_to_jiffies(pdata->batmon_interval ? : 10);
charger->charge_milliamp = pdata->charge_milliamp;
charger->charge_millivolt = pdata->charge_millivolt;
--
2.43.0
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH v3 11/16] nvme: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Easwar Hariharan
` (9 preceding siblings ...)
2025-02-25 20:17 ` [PATCH v3 10/16] power: supply: da9030: " Easwar Hariharan
@ 2025-02-25 20:17 ` Easwar Hariharan
2025-02-25 20:17 ` [PATCH v3 12/16] spi: spi-fsl-lpspi: " Easwar Hariharan
` (8 subsequent siblings)
19 siblings, 0 replies; 39+ messages in thread
From: Easwar Hariharan @ 2025-02-25 20:17 UTC (permalink / raw)
To: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky
Cc: cocci, linux-kernel, linux-scsi, dri-devel, linux-sound,
linux-btrfs, ceph-devel, linux-block, linux-ide, linux-xfs,
linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Easwar Hariharan
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
+secs_to_jiffies
(E
- * \( 1000 \| MSEC_PER_SEC \)
)
Acked-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
---
drivers/nvme/host/core.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index f028913e2e622ee348e88879c6e6b7e8f8a1cc82..24c3e1765d491daf8fd600f96788bf5765946f54 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -4466,11 +4466,9 @@ static void nvme_fw_act_work(struct work_struct *work)
nvme_auth_stop(ctrl);
if (ctrl->mtfa)
- fw_act_timeout = jiffies +
- msecs_to_jiffies(ctrl->mtfa * 100);
+ fw_act_timeout = jiffies + msecs_to_jiffies(ctrl->mtfa * 100);
else
- fw_act_timeout = jiffies +
- msecs_to_jiffies(admin_timeout * 1000);
+ fw_act_timeout = jiffies + secs_to_jiffies(admin_timeout);
nvme_quiesce_io_queues(ctrl);
while (nvme_ctrl_pp_status(ctrl)) {
--
2.43.0
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH v3 12/16] spi: spi-fsl-lpspi: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Easwar Hariharan
` (10 preceding siblings ...)
2025-02-25 20:17 ` [PATCH v3 11/16] nvme: " Easwar Hariharan
@ 2025-02-25 20:17 ` Easwar Hariharan
2025-02-25 20:17 ` [PATCH v3 13/16] spi: spi-imx: " Easwar Hariharan
` (7 subsequent siblings)
19 siblings, 0 replies; 39+ messages in thread
From: Easwar Hariharan @ 2025-02-25 20:17 UTC (permalink / raw)
To: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky
Cc: cocci, linux-kernel, linux-scsi, dri-devel, linux-sound,
linux-btrfs, ceph-devel, linux-block, linux-ide, linux-xfs,
linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Easwar Hariharan
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
+secs_to_jiffies
(E
- * \( 1000 \| MSEC_PER_SEC \)
)
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
---
drivers/spi/spi-fsl-lpspi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c
index 40f5c8fdba765a1334710a696966232a459316e6..5e381844523440c03b1d0bbe4a044f28fbfbc738 100644
--- a/drivers/spi/spi-fsl-lpspi.c
+++ b/drivers/spi/spi-fsl-lpspi.c
@@ -572,7 +572,7 @@ static int fsl_lpspi_calculate_timeout(struct fsl_lpspi_data *fsl_lpspi,
timeout += 1;
/* Double calculated timeout */
- return msecs_to_jiffies(2 * timeout * MSEC_PER_SEC);
+ return secs_to_jiffies(2 * timeout);
}
static int fsl_lpspi_dma_transfer(struct spi_controller *controller,
--
2.43.0
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH v3 13/16] spi: spi-imx: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Easwar Hariharan
` (11 preceding siblings ...)
2025-02-25 20:17 ` [PATCH v3 12/16] spi: spi-fsl-lpspi: " Easwar Hariharan
@ 2025-02-25 20:17 ` Easwar Hariharan
2025-02-25 20:27 ` Marc Kleine-Budde
2025-02-25 20:17 ` [PATCH v3 14/16] platform/x86/amd/pmf: " Easwar Hariharan
` (6 subsequent siblings)
19 siblings, 1 reply; 39+ messages in thread
From: Easwar Hariharan @ 2025-02-25 20:17 UTC (permalink / raw)
To: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky
Cc: cocci, linux-kernel, linux-scsi, dri-devel, linux-sound,
linux-btrfs, ceph-devel, linux-block, linux-ide, linux-xfs,
linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Easwar Hariharan
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
+secs_to_jiffies
(E
- * \( 1000 \| MSEC_PER_SEC \)
)
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
---
drivers/spi/spi-imx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index eeb7d082c2472f954001045295b349bc2eb53197..832d6e9009ebe741779acd58c3a9450c231151bb 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -1449,7 +1449,7 @@ static int spi_imx_calculate_timeout(struct spi_imx_data *spi_imx, int size)
timeout += 1;
/* Double calculated timeout */
- return msecs_to_jiffies(2 * timeout * MSEC_PER_SEC);
+ return secs_to_jiffies(2 * timeout);
}
static int spi_imx_dma_transfer(struct spi_imx_data *spi_imx,
--
2.43.0
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH v3 14/16] platform/x86/amd/pmf: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Easwar Hariharan
` (12 preceding siblings ...)
2025-02-25 20:17 ` [PATCH v3 13/16] spi: spi-imx: " Easwar Hariharan
@ 2025-02-25 20:17 ` Easwar Hariharan
2025-03-21 16:08 ` Ilpo Järvinen
2025-02-25 20:17 ` [PATCH v3 15/16] platform/x86: thinkpad_acpi: " Easwar Hariharan
` (5 subsequent siblings)
19 siblings, 1 reply; 39+ messages in thread
From: Easwar Hariharan @ 2025-02-25 20:17 UTC (permalink / raw)
To: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky
Cc: cocci, linux-kernel, linux-scsi, dri-devel, linux-sound,
linux-btrfs, ceph-devel, linux-block, linux-ide, linux-xfs,
linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Easwar Hariharan
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
+secs_to_jiffies
(E
- * \( 1000 \| MSEC_PER_SEC \)
)
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
---
drivers/platform/x86/amd/pmf/acpi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/amd/pmf/acpi.c b/drivers/platform/x86/amd/pmf/acpi.c
index dd5780a1d06e1dc979fcff5bafd6729bc4937eab..f75f7ecd8cd91c9d55abc38ce6e46eed7fe69fc0 100644
--- a/drivers/platform/x86/amd/pmf/acpi.c
+++ b/drivers/platform/x86/amd/pmf/acpi.c
@@ -220,7 +220,7 @@ static void apmf_sbios_heartbeat_notify(struct work_struct *work)
if (!info)
return;
- schedule_delayed_work(&dev->heart_beat, msecs_to_jiffies(dev->hb_interval * 1000));
+ schedule_delayed_work(&dev->heart_beat, secs_to_jiffies(dev->hb_interval));
kfree(info);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH v3 15/16] platform/x86: thinkpad_acpi: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Easwar Hariharan
` (13 preceding siblings ...)
2025-02-25 20:17 ` [PATCH v3 14/16] platform/x86/amd/pmf: " Easwar Hariharan
@ 2025-02-25 20:17 ` Easwar Hariharan
2025-03-21 16:06 ` Ilpo Järvinen
2025-02-25 20:17 ` [PATCH v3 16/16] RDMA/bnxt_re: " Easwar Hariharan
` (4 subsequent siblings)
19 siblings, 1 reply; 39+ messages in thread
From: Easwar Hariharan @ 2025-02-25 20:17 UTC (permalink / raw)
To: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky
Cc: cocci, linux-kernel, linux-scsi, dri-devel, linux-sound,
linux-btrfs, ceph-devel, linux-block, linux-ide, linux-xfs,
linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Easwar Hariharan
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
+secs_to_jiffies
(E
- * \( 1000 \| MSEC_PER_SEC \)
)
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
---
drivers/platform/x86/thinkpad_acpi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index ab1cade5ef231e9a9a520bc0cca82384c911a331..d269e791f7fbc2a8ccf96f28cb476beccb57c9a7 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -8512,7 +8512,7 @@ static void fan_watchdog_reset(void)
if (fan_watchdog_maxinterval > 0 &&
tpacpi_lifecycle != TPACPI_LIFE_EXITING)
mod_delayed_work(tpacpi_wq, &fan_watchdog_task,
- msecs_to_jiffies(fan_watchdog_maxinterval * 1000));
+ secs_to_jiffies(fan_watchdog_maxinterval));
else
cancel_delayed_work(&fan_watchdog_task);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH v3 16/16] RDMA/bnxt_re: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Easwar Hariharan
` (14 preceding siblings ...)
2025-02-25 20:17 ` [PATCH v3 15/16] platform/x86: thinkpad_acpi: " Easwar Hariharan
@ 2025-02-25 20:17 ` Easwar Hariharan
2025-02-25 20:30 ` (subset) [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Jens Axboe
` (3 subsequent siblings)
19 siblings, 0 replies; 39+ messages in thread
From: Easwar Hariharan @ 2025-02-25 20:17 UTC (permalink / raw)
To: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky
Cc: cocci, linux-kernel, linux-scsi, dri-devel, linux-sound,
linux-btrfs, ceph-devel, linux-block, linux-ide, linux-xfs,
linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Easwar Hariharan
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
+secs_to_jiffies
(E
- * \( 1000 \| MSEC_PER_SEC \)
)
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
---
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
index 17e62f22683b14a3571188e25fe0df3cbf1d8360..b1a18c9cb7f6c248548bc38fcb98781a3030a1b6 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
@@ -160,7 +160,7 @@ static int __wait_for_resp(struct bnxt_qplib_rcfw *rcfw, u16 cookie)
wait_event_timeout(cmdq->waitq,
!crsqe->is_in_used ||
test_bit(ERR_DEVICE_DETACHED, &cmdq->flags),
- msecs_to_jiffies(rcfw->max_timeout * 1000));
+ secs_to_jiffies(rcfw->max_timeout));
if (!crsqe->is_in_used)
return 0;
--
2.43.0
^ permalink raw reply related [flat|nested] 39+ messages in thread
* Re: [PATCH v3 08/16] ata: libata-zpodd: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 ` [PATCH v3 08/16] ata: libata-zpodd: " Easwar Hariharan
@ 2025-02-25 20:24 ` Easwar Hariharan
2025-02-26 2:00 ` Damien Le Moal
0 siblings, 1 reply; 39+ messages in thread
From: Easwar Hariharan @ 2025-02-25 20:24 UTC (permalink / raw)
To: Andrew Morton, Damien Le Moal
Cc: Yaron Avizrat, Oded Gabbay, Julia Lawall, Nicolas Palix,
James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Niklas Cassel, Carlos Maiolino,
Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky, eahariha, cocci, linux-kernel,
linux-scsi, dri-devel, linux-sound, linux-btrfs, ceph-devel,
linux-block, linux-ide, linux-xfs, linux-pm, linux-nvme,
linux-spi, imx, linux-arm-kernel, platform-driver-x86,
ibm-acpi-devel, linux-rdma
On 2/25/2025 12:17 PM, Easwar Hariharan wrote:
> 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
> +secs_to_jiffies
> (E
> - * \( 1000 \| MSEC_PER_SEC \)
> )
>
> Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
> ---
This was meant to carry Damien's ack once the subject line was fixed[1], but I fixed
the subject line and missed adding the ack in. Damien, would you like to ack again?
[1]: https://lore.kernel.org/all/f39cde78-19de-45fc-9c64-d3656e07d4a7@kernel.org/
Thanks, and apologies,
Easwar (he/him)
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH v3 13/16] spi: spi-imx: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 ` [PATCH v3 13/16] spi: spi-imx: " Easwar Hariharan
@ 2025-02-25 20:27 ` Marc Kleine-Budde
0 siblings, 0 replies; 39+ messages in thread
From: Marc Kleine-Budde @ 2025-02-25 20:27 UTC (permalink / raw)
To: Easwar Hariharan
Cc: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky, linux-arm-kernel, linux-xfs,
linux-nvme, cocci, linux-scsi, linux-pm, linux-rdma, linux-kernel,
dri-devel, linux-spi, linux-block, linux-ide, linux-sound,
ibm-acpi-devel, ceph-devel, platform-driver-x86, imx, linux-btrfs
[-- Attachment #1: Type: text/plain, Size: 977 bytes --]
On 25.02.2025 20:17:27, Easwar Hariharan wrote:
> 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
> +secs_to_jiffies
> (E
> - * \( 1000 \| MSEC_PER_SEC \)
> )
>
> Acked-by: Mark Brown <broonie@kernel.org>
> Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: (subset) [PATCH v3 00/16] Converge on using secs_to_jiffies() part two
2025-02-25 20:17 [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Easwar Hariharan
` (15 preceding siblings ...)
2025-02-25 20:17 ` [PATCH v3 16/16] RDMA/bnxt_re: " Easwar Hariharan
@ 2025-02-25 20:30 ` Jens Axboe
2025-02-26 11:29 ` Mark Brown
` (2 subsequent siblings)
19 siblings, 0 replies; 39+ messages in thread
From: Jens Axboe @ 2025-02-25 20:30 UTC (permalink / raw)
To: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang, Xiubo Li,
Damien Le Moal, Niklas Cassel, Carlos Maiolino, Darrick J. Wong,
Sebastian Reichel, Keith Busch, Christoph Hellwig, Sagi Grimberg,
Frank Li, Mark Brown, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Shyam Sundar S K,
Hans de Goede, Ilpo Järvinen, Henrique de Moraes Holschuh,
Selvin Xavier, Kalesh AP, Jason Gunthorpe, Leon Romanovsky,
Easwar Hariharan
Cc: cocci, linux-kernel, linux-scsi, dri-devel, linux-sound,
linux-btrfs, ceph-devel, linux-block, linux-ide, linux-xfs,
linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Takashi Iwai,
Carlos Maiolino
On Tue, 25 Feb 2025 20:17:14 +0000, Easwar Hariharan wrote:
> This is the second series (part 1*) that converts users of msecs_to_jiffies() that
> either use the multiply pattern of either of:
> - msecs_to_jiffies(N*1000) or
> - msecs_to_jiffies(N*MSEC_PER_SEC)
>
> where N is a constant or an expression, to avoid the multiplication.
>
> [...]
Applied, thanks!
[06/16] rbd: convert timeouts to secs_to_jiffies()
commit: c02eea7eeaebd7270cb8ff09049cc7e0fc9bc8da
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH v3 06/16] rbd: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 ` [PATCH v3 06/16] rbd: " Easwar Hariharan
@ 2025-02-25 21:09 ` Christophe JAILLET
2025-02-26 0:02 ` Easwar Hariharan
2025-02-26 7:28 ` Daniel Vacek
0 siblings, 2 replies; 39+ messages in thread
From: Christophe JAILLET @ 2025-02-25 21:09 UTC (permalink / raw)
To: Easwar Hariharan
Cc: Frank.Li, James.Bottomley, Julia.Lawall, Shyam-sundar.S-k, akpm,
axboe, broonie, cassel, cem, ceph-devel, clm, cocci, dick.kennedy,
djwong, dlemoal, dongsheng.yang, dri-devel, dsterba, festevam,
hch, hdegoede, hmh, ibm-acpi-devel, idryomov, ilpo.jarvinen, imx,
james.smart, jgg, josef, kalesh-anakkur.purayil, kbusch, kernel,
leon, linux-arm-kernel, linux-block, linux-btrfs, linux-ide,
linux-kernel, linux-nvme, linux-pm, linux-rdma, linux-scsi,
linux-sound, linux-spi, linux-xfs, martin.petersen, nicolas.palix,
ogabbay, perex, platform-driver-x86, s.hauer, sagi, selvin.xavier,
shawnguo, sre, tiwai, xiubli, yaron.avizrat
Le 25/02/2025 à 21:17, Easwar Hariharan a écrit :
> 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)
>
> @depends on patch@ expression E; @@
>
> -msecs_to_jiffies(E * MSEC_PER_SEC)
> +secs_to_jiffies(E)
>
> While here, remove the no-longer necessary check for range since there's
> no multiplication involved.
I'm not sure this is correct.
Now you multiply by HZ and things can still overflow.
Hoping I got casting right:
#define MSEC_PER_SEC 1000L
#define HZ 100
#define secs_to_jiffies(_secs) (unsigned long)((_secs) * HZ)
static inline unsigned long _msecs_to_jiffies(const unsigned int m)
{
return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ);
}
int main() {
int n = INT_MAX - 5;
printf("res = %ld\n", secs_to_jiffies(n));
printf("res = %ld\n", _msecs_to_jiffies(1000 * n));
return 0;
}
gives :
res = -600
res = 429496130
with msec, the previous code would catch the overflow, now it overflows
silently.
untested, but maybe:
if (result.uint_32 > INT_MAX / HZ)
goto out_of_range;
?
CJ
>
> Acked-by: Ilya Dryomov <idryomov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Easwar Hariharan <eahariha-1pm0nblsJy7Jp67UH1NAhkEOCMrvLtNR@public.gmane.org>
> ---
> drivers/block/rbd.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index faafd7ff43d6ef53110ab3663cc7ac322214cc8c..41207133e21e9203192adf3b92390818e8fa5a58 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -108,7 +108,7 @@ static int atomic_dec_return_safe(atomic_t *v)
> #define RBD_OBJ_PREFIX_LEN_MAX 64
>
> #define RBD_NOTIFY_TIMEOUT 5 /* seconds */
> -#define RBD_RETRY_DELAY msecs_to_jiffies(1000)
> +#define RBD_RETRY_DELAY secs_to_jiffies(1)
>
> /* Feature bits */
>
> @@ -4162,7 +4162,7 @@ static void rbd_acquire_lock(struct work_struct *work)
> dout("%s rbd_dev %p requeuing lock_dwork\n", __func__,
> rbd_dev);
> mod_delayed_work(rbd_dev->task_wq, &rbd_dev->lock_dwork,
> - msecs_to_jiffies(2 * RBD_NOTIFY_TIMEOUT * MSEC_PER_SEC));
> + secs_to_jiffies(2 * RBD_NOTIFY_TIMEOUT));
> }
> }
>
> @@ -6283,9 +6283,7 @@ static int rbd_parse_param(struct fs_parameter *param,
> break;
> case Opt_lock_timeout:
> /* 0 is "wait forever" (i.e. infinite timeout) */
> - if (result.uint_32 > INT_MAX / 1000)
> - goto out_of_range;
> - opt->lock_timeout = msecs_to_jiffies(result.uint_32 * 1000);
> + opt->lock_timeout = secs_to_jiffies(result.uint_32);
> break;
> case Opt_pool_ns:
> kfree(pctx->spec->pool_ns);
>
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH v3 07/16] libceph: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 ` [PATCH v3 07/16] libceph: " Easwar Hariharan
@ 2025-02-25 21:25 ` Christophe JAILLET
0 siblings, 0 replies; 39+ messages in thread
From: Christophe JAILLET @ 2025-02-25 21:25 UTC (permalink / raw)
To: Easwar Hariharan
Cc: Frank.Li, James.Bottomley, Julia.Lawall, Shyam-sundar.S-k, akpm,
axboe, broonie, cassel, cem, ceph-devel, clm, cocci, dick.kennedy,
djwong, dlemoal, dongsheng.yang, dri-devel, dsterba, festevam,
hch, hdegoede, hmh, ibm-acpi-devel, idryomov, ilpo.jarvinen, imx,
james.smart, jgg, josef, kalesh-anakkur.purayil, kbusch, kernel,
leon, linux-arm-kernel, linux-block, linux-btrfs, linux-ide,
linux-kernel, linux-nvme, linux-pm, linux-rdma, linux-scsi,
linux-sound, linux-spi, linux-xfs, martin.petersen, nicolas.palix,
ogabbay, perex, platform-driver-x86, s.hauer, sagi, selvin.xavier,
shawnguo, sre, tiwai, xiubli, yaron.avizrat
Le 25/02/2025 à 21:17, Easwar Hariharan a écrit :
> 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)
>
> @depends on patch@ expression E; @@
>
> -msecs_to_jiffies(E * MSEC_PER_SEC)
> +secs_to_jiffies(E)
>
> While here, remove the no-longer necessary checks for range since there's
> no multiplication involved.
No sure it is correct.
Same comment as on patch 06/16, available at [1].
CJ
[1]:
https://lore.kernel.org/linux-kernel/e53d7586-b278-4338-95a2-fa768d5d8b5e@wanadoo.fr/
>
> Acked-by: Ilya Dryomov <idryomov@gmail.com>
> Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
> ---
> include/linux/ceph/libceph.h | 12 ++++++------
> net/ceph/ceph_common.c | 18 ++++++------------
> net/ceph/osd_client.c | 3 +--
> 3 files changed, 13 insertions(+), 20 deletions(-)
>
> diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
> index 733e7f93db66a7a29a4a8eba97e9ebf2c49da1f9..5f57128ef0c7d018341c15cc59288aa47edec646 100644
> --- a/include/linux/ceph/libceph.h
> +++ b/include/linux/ceph/libceph.h
> @@ -72,15 +72,15 @@ struct ceph_options {
> /*
> * defaults
> */
> -#define CEPH_MOUNT_TIMEOUT_DEFAULT msecs_to_jiffies(60 * 1000)
> -#define CEPH_OSD_KEEPALIVE_DEFAULT msecs_to_jiffies(5 * 1000)
> -#define CEPH_OSD_IDLE_TTL_DEFAULT msecs_to_jiffies(60 * 1000)
> +#define CEPH_MOUNT_TIMEOUT_DEFAULT secs_to_jiffies(60)
> +#define CEPH_OSD_KEEPALIVE_DEFAULT secs_to_jiffies(5)
> +#define CEPH_OSD_IDLE_TTL_DEFAULT secs_to_jiffies(60)
> #define CEPH_OSD_REQUEST_TIMEOUT_DEFAULT 0 /* no timeout */
> #define CEPH_READ_FROM_REPLICA_DEFAULT 0 /* read from primary */
>
> -#define CEPH_MONC_HUNT_INTERVAL msecs_to_jiffies(3 * 1000)
> -#define CEPH_MONC_PING_INTERVAL msecs_to_jiffies(10 * 1000)
> -#define CEPH_MONC_PING_TIMEOUT msecs_to_jiffies(30 * 1000)
> +#define CEPH_MONC_HUNT_INTERVAL secs_to_jiffies(3)
> +#define CEPH_MONC_PING_INTERVAL secs_to_jiffies(10)
> +#define CEPH_MONC_PING_TIMEOUT secs_to_jiffies(30)
> #define CEPH_MONC_HUNT_BACKOFF 2
> #define CEPH_MONC_HUNT_MAX_MULT 10
>
> diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
> index 4c6441536d55b6323f4b9d93b5d4837cd4ec880c..c2a2c3bcc4e91a628c99bd1cef1211d54389efa2 100644
> --- a/net/ceph/ceph_common.c
> +++ b/net/ceph/ceph_common.c
> @@ -527,29 +527,23 @@ int ceph_parse_param(struct fs_parameter *param, struct ceph_options *opt,
>
> case Opt_osdkeepalivetimeout:
> /* 0 isn't well defined right now, reject it */
> - if (result.uint_32 < 1 || result.uint_32 > INT_MAX / 1000)
> + if (result.uint_32 < 1)
> goto out_of_range;
> - opt->osd_keepalive_timeout =
> - msecs_to_jiffies(result.uint_32 * 1000);
> + opt->osd_keepalive_timeout = secs_to_jiffies(result.uint_32);
> break;
> case Opt_osd_idle_ttl:
> /* 0 isn't well defined right now, reject it */
> - if (result.uint_32 < 1 || result.uint_32 > INT_MAX / 1000)
> + if (result.uint_32 < 1)
> goto out_of_range;
> - opt->osd_idle_ttl = msecs_to_jiffies(result.uint_32 * 1000);
> + opt->osd_idle_ttl = secs_to_jiffies(result.uint_32);
> break;
> case Opt_mount_timeout:
> /* 0 is "wait forever" (i.e. infinite timeout) */
> - if (result.uint_32 > INT_MAX / 1000)
> - goto out_of_range;
> - opt->mount_timeout = msecs_to_jiffies(result.uint_32 * 1000);
> + opt->mount_timeout = secs_to_jiffies(result.uint_32);
> break;
> case Opt_osd_request_timeout:
> /* 0 is "wait forever" (i.e. infinite timeout) */
> - if (result.uint_32 > INT_MAX / 1000)
> - goto out_of_range;
> - opt->osd_request_timeout =
> - msecs_to_jiffies(result.uint_32 * 1000);
> + opt->osd_request_timeout = secs_to_jiffies(result.uint_32);
> break;
>
> case Opt_share:
> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> index b24afec241382b60d775dd12a6561fa23a7eca45..ba61a48b4388c2eceb5b7a299906e7f90191dd5d 100644
> --- a/net/ceph/osd_client.c
> +++ b/net/ceph/osd_client.c
> @@ -4989,8 +4989,7 @@ int ceph_osdc_notify(struct ceph_osd_client *osdc,
> linger_submit(lreq);
> ret = linger_reg_commit_wait(lreq);
> if (!ret)
> - ret = linger_notify_finish_wait(lreq,
> - msecs_to_jiffies(2 * timeout * MSEC_PER_SEC));
> + ret = linger_notify_finish_wait(lreq, secs_to_jiffies(2 * timeout));
> else
> dout("lreq %p failed to initiate notify %d\n", lreq, ret);
>
>
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH v3 06/16] rbd: convert timeouts to secs_to_jiffies()
2025-02-25 21:09 ` Christophe JAILLET
@ 2025-02-26 0:02 ` Easwar Hariharan
2025-02-26 7:28 ` Daniel Vacek
1 sibling, 0 replies; 39+ messages in thread
From: Easwar Hariharan @ 2025-02-26 0:02 UTC (permalink / raw)
To: Christophe JAILLET
Cc: eahariha, Frank.Li, James.Bottomley, Julia.Lawall,
Shyam-sundar.S-k, akpm, axboe, broonie, cassel, cem, ceph-devel,
clm, cocci, dick.kennedy, djwong, dlemoal, dongsheng.yang,
dri-devel, dsterba, festevam, hch, hdegoede, hmh, ibm-acpi-devel,
idryomov, ilpo.jarvinen, imx, james.smart, jgg, josef,
kalesh-anakkur.purayil, kbusch, kernel, leon, linux-arm-kernel,
linux-block, linux-btrfs, linux-ide, linux-kernel, linux-nvme,
linux-pm, linux-rdma, linux-scsi, linux-sound, linux-spi,
linux-xfs, martin.petersen, nicolas.palix, ogabbay, perex,
platform-driver-x86, s.hauer, sagi, selvin.xavier, shawnguo, sre,
tiwai, xiubli, yaron.avizrat
On 2/25/2025 1:09 PM, Christophe JAILLET wrote:
> Le 25/02/2025 à 21:17, Easwar Hariharan a écrit :
>> 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)
>>
>> @depends on patch@ expression E; @@
>>
>> -msecs_to_jiffies(E * MSEC_PER_SEC)
>> +secs_to_jiffies(E)
>>
>> While here, remove the no-longer necessary check for range since there's
>> no multiplication involved.
>
> I'm not sure this is correct.
> Now you multiply by HZ and things can still overflow.
>
>
> Hoping I got casting right:
>
> #define MSEC_PER_SEC 1000L
> #define HZ 100
>
>
> #define secs_to_jiffies(_secs) (unsigned long)((_secs) * HZ)
>
> static inline unsigned long _msecs_to_jiffies(const unsigned int m)
> {
> return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ);
> }
>
> int main() {
>
> int n = INT_MAX - 5;
>
> printf("res = %ld\n", secs_to_jiffies(n));
> printf("res = %ld\n", _msecs_to_jiffies(1000 * n));
>
> return 0;
> }
>
>
> gives :
>
> res = -600
> res = 429496130
>
> with msec, the previous code would catch the overflow, now it overflows silently.
>
> untested, but maybe:
> if (result.uint_32 > INT_MAX / HZ)
> goto out_of_range;
>
> ?
>
> CJ
>
Thanks for the review! I was able to replicate your results, I'll try this range check
and get back.
Thanks,
Easwar (he/him)
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH v3 08/16] ata: libata-zpodd: convert timeouts to secs_to_jiffies()
2025-02-25 20:24 ` Easwar Hariharan
@ 2025-02-26 2:00 ` Damien Le Moal
0 siblings, 0 replies; 39+ messages in thread
From: Damien Le Moal @ 2025-02-26 2:00 UTC (permalink / raw)
To: Easwar Hariharan, Andrew Morton
Cc: Yaron Avizrat, Oded Gabbay, Julia Lawall, Nicolas Palix,
James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Niklas Cassel, Carlos Maiolino,
Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky, cocci, linux-kernel, linux-scsi,
dri-devel, linux-sound, linux-btrfs, ceph-devel, linux-block,
linux-ide, linux-xfs, linux-pm, linux-nvme, linux-spi, imx,
linux-arm-kernel, platform-driver-x86, ibm-acpi-devel, linux-rdma
On 2/26/25 5:24 AM, Easwar Hariharan wrote:
> On 2/25/2025 12:17 PM, Easwar Hariharan wrote:
>> 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
>> +secs_to_jiffies
>> (E
>> - * \( 1000 \| MSEC_PER_SEC \)
>> )
>>
>> Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
>> ---
>
> This was meant to carry Damien's ack once the subject line was fixed[1], but I fixed
> the subject line and missed adding the ack in. Damien, would you like to ack again?
Looks like Andrew already applied the patch, which is fine.
But nevertheless:
Acked-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH v3 06/16] rbd: convert timeouts to secs_to_jiffies()
2025-02-25 21:09 ` Christophe JAILLET
2025-02-26 0:02 ` Easwar Hariharan
@ 2025-02-26 7:28 ` Daniel Vacek
2025-02-26 8:10 ` Christophe JAILLET
1 sibling, 1 reply; 39+ messages in thread
From: Daniel Vacek @ 2025-02-26 7:28 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Easwar Hariharan, Frank.Li, James.Bottomley, Julia.Lawall,
Shyam-sundar.S-k, akpm, axboe, broonie, cassel, cem, ceph-devel,
clm, cocci, dick.kennedy, djwong, dlemoal, dongsheng.yang,
dri-devel, dsterba, festevam, hch, hdegoede, hmh, ibm-acpi-devel,
idryomov, ilpo.jarvinen, imx, james.smart, jgg, josef,
kalesh-anakkur.purayil, kbusch, kernel, leon, linux-arm-kernel,
linux-block, linux-btrfs, linux-ide, linux-kernel, linux-nvme,
linux-pm, linux-rdma, linux-scsi, linux-sound, linux-spi,
linux-xfs, martin.petersen, nicolas.palix, ogabbay, perex,
platform-driver-x86, s.hauer, sagi, selvin.xavier, shawnguo, sre,
tiwai, xiubli, yaron.avizrat
On Tue, 25 Feb 2025 at 22:10, Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> Le 25/02/2025 à 21:17, Easwar Hariharan a écrit :
> > 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)
> >
> > @depends on patch@ expression E; @@
> >
> > -msecs_to_jiffies(E * MSEC_PER_SEC)
> > +secs_to_jiffies(E)
> >
> > While here, remove the no-longer necessary check for range since there's
> > no multiplication involved.
>
> I'm not sure this is correct.
> Now you multiply by HZ and things can still overflow.
This does not deal with any additional multiplications. If there is an
overflow, it was already there before to begin with, IMO.
> Hoping I got casting right:
Maybe not exactly? See below...
> #define MSEC_PER_SEC 1000L
> #define HZ 100
>
>
> #define secs_to_jiffies(_secs) (unsigned long)((_secs) * HZ)
>
> static inline unsigned long _msecs_to_jiffies(const unsigned int m)
> {
> return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ);
> }
>
> int main() {
>
> int n = INT_MAX - 5;
>
> printf("res = %ld\n", secs_to_jiffies(n));
> printf("res = %ld\n", _msecs_to_jiffies(1000 * n));
I think the format should actually be %lu giving the below results:
res = 18446744073709551016
res = 429496130
Which is still wrong nonetheless. But here, *both* results are wrong
as the expected output should be 214748364200 which you'll get with
the correct helper/macro.
But note another thing, the 1000 * (INT_MAX - 5) already overflows
even before calling _msecs_to_jiffies(). See?
Now, you'll get that mentioned correct result with:
#define secs_to_jiffies(_secs) ((unsigned long)(_secs) * HZ)
Still, why unsigned? What if you wanted to convert -5 seconds to jiffies?
> return 0;
> }
>
>
> gives :
>
> res = -600
> res = 429496130
>
> with msec, the previous code would catch the overflow, now it overflows
> silently.
What compiler options are you using? I'm not getting any warnings.
> untested, but maybe:
> if (result.uint_32 > INT_MAX / HZ)
> goto out_of_range;
>
> ?
>
> CJ
>
>
> >
> > Acked-by: Ilya Dryomov <idryomov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > Signed-off-by: Easwar Hariharan <eahariha-1pm0nblsJy7Jp67UH1NAhkEOCMrvLtNR@public.gmane.org>
> > ---
> > drivers/block/rbd.c | 8 +++-----
> > 1 file changed, 3 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> > index faafd7ff43d6ef53110ab3663cc7ac322214cc8c..41207133e21e9203192adf3b92390818e8fa5a58 100644
> > --- a/drivers/block/rbd.c
> > +++ b/drivers/block/rbd.c
> > @@ -108,7 +108,7 @@ static int atomic_dec_return_safe(atomic_t *v)
> > #define RBD_OBJ_PREFIX_LEN_MAX 64
> >
> > #define RBD_NOTIFY_TIMEOUT 5 /* seconds */
> > -#define RBD_RETRY_DELAY msecs_to_jiffies(1000)
> > +#define RBD_RETRY_DELAY secs_to_jiffies(1)
> >
> > /* Feature bits */
> >
> > @@ -4162,7 +4162,7 @@ static void rbd_acquire_lock(struct work_struct *work)
> > dout("%s rbd_dev %p requeuing lock_dwork\n", __func__,
> > rbd_dev);
> > mod_delayed_work(rbd_dev->task_wq, &rbd_dev->lock_dwork,
> > - msecs_to_jiffies(2 * RBD_NOTIFY_TIMEOUT * MSEC_PER_SEC));
> > + secs_to_jiffies(2 * RBD_NOTIFY_TIMEOUT));
> > }
> > }
> >
> > @@ -6283,9 +6283,7 @@ static int rbd_parse_param(struct fs_parameter *param,
> > break;
> > case Opt_lock_timeout:
> > /* 0 is "wait forever" (i.e. infinite timeout) */
> > - if (result.uint_32 > INT_MAX / 1000)
> > - goto out_of_range;
> > - opt->lock_timeout = msecs_to_jiffies(result.uint_32 * 1000);
> > + opt->lock_timeout = secs_to_jiffies(result.uint_32);
> > break;
> > case Opt_pool_ns:
> > kfree(pctx->spec->pool_ns);
> >
>
>
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH v3 06/16] rbd: convert timeouts to secs_to_jiffies()
2025-02-26 7:28 ` Daniel Vacek
@ 2025-02-26 8:10 ` Christophe JAILLET
2025-02-26 8:29 ` Daniel Vacek
0 siblings, 1 reply; 39+ messages in thread
From: Christophe JAILLET @ 2025-02-26 8:10 UTC (permalink / raw)
To: neelx
Cc: Frank.Li, James.Bottomley, Julia.Lawall, Shyam-sundar.S-k, akpm,
axboe, broonie, cassel, cem, ceph-devel, christophe.jaillet, clm,
cocci, dick.kennedy, djwong, dlemoal, dongsheng.yang, dri-devel,
dsterba, eahariha, festevam, hch, hdegoede, hmh, ibm-acpi-devel,
idryomov, ilpo.jarvinen, imx, james.smart, jgg, josef,
kalesh-anakkur.purayil, kbusch, kernel, leon, linux-arm-kernel,
linux-block, linux-btrfs, linux-ide, linux-kernel, linux-nvme,
linux-pm, linux-rdma, linux-scsi, linux-sound, linux-spi,
linux-xfs, martin.petersen, nicolas.palix, ogabbay, perex,
platform-driver-x86, s.hauer, sagi, selvin.xavier, shawnguo, sre,
tiwai, xiubli, yaron.avizrat
Le 26/02/2025 à 08:28, Daniel Vacek a écrit :
> On Tue, 25 Feb 2025 at 22:10, Christophe JAILLET
> <christophe.jaillet-39ZsbGIQGT5GWvitb5QawA@public.gmane.org> wrote:
>>
>> Le 25/02/2025 à 21:17, Easwar Hariharan a écrit :
>>> 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)
>>>
>>> @depends on patch@ expression E; @@
>>>
>>> -msecs_to_jiffies(E * MSEC_PER_SEC)
>>> +secs_to_jiffies(E)
>>>
>>> While here, remove the no-longer necessary check for range since there's
>>> no multiplication involved.
>>
>> I'm not sure this is correct.
>> Now you multiply by HZ and things can still overflow.
>
> This does not deal with any additional multiplications. If there is an
> overflow, it was already there before to begin with, IMO.
>
>> Hoping I got casting right:
>
> Maybe not exactly? See below...
>
>> #define MSEC_PER_SEC 1000L
>> #define HZ 100
>>
>>
>> #define secs_to_jiffies(_secs) (unsigned long)((_secs) * HZ)
>>
>> static inline unsigned long _msecs_to_jiffies(const unsigned int m)
>> {
>> return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ);
>> }
>>
>> int main() {
>>
>> int n = INT_MAX - 5;
>>
>> printf("res = %ld\n", secs_to_jiffies(n));
>> printf("res = %ld\n", _msecs_to_jiffies(1000 * n));
>
> I think the format should actually be %lu giving the below results:
>
> res = 18446744073709551016
> res = 429496130
>
> Which is still wrong nonetheless. But here, *both* results are wrong
> as the expected output should be 214748364200 which you'll get with
> the correct helper/macro.
>
> But note another thing, the 1000 * (INT_MAX - 5) already overflows
> even before calling _msecs_to_jiffies(). See?
Agreed and intentional in my test C code.
That is the point.
The "if (result.uint_32 > INT_MAX / 1000)" in the original code was
handling such values.
>
> Now, you'll get that mentioned correct result with:
>
> #define secs_to_jiffies(_secs) ((unsigned long)(_secs) * HZ)
Not looked in details, but I think I would second on you on this, in
this specific example. Not sure if it would handle all possible uses of
secs_to_jiffies().
But it is not how secs_to_jiffies() is defined up to now. See [1].
[1]:
https://elixir.bootlin.com/linux/v6.14-rc4/source/include/linux/jiffies.h#L540
>
> Still, why unsigned? What if you wanted to convert -5 seconds to jiffies?
See commit bb2784d9ab495 which added the cast.
>
>> return 0;
>> }
>>
>>
>> gives :
>>
>> res = -600
>> res = 429496130
>>
>> with msec, the previous code would catch the overflow, now it overflows
>> silently.
>
> What compiler options are you using? I'm not getting any warnings.
I mean, with:
if (result.uint_32 > INT_MAX / 1000)
goto out_of_range;
the overflow would be handled *at runtime*.
Without such a check, an unexpected value could be stored in
opt->lock_timeout.
I think that a test is needed and with secs_to_jiffies(), I tentatively
proposed:
if (result.uint_32 > INT_MAX / HZ)
goto out_of_range;
CJ
>
>> untested, but maybe:
>> if (result.uint_32 > INT_MAX / HZ)
>> goto out_of_range;
>>
>> ?
>>
>> CJ
>>
...
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH v3 06/16] rbd: convert timeouts to secs_to_jiffies()
2025-02-26 8:10 ` Christophe JAILLET
@ 2025-02-26 8:29 ` Daniel Vacek
0 siblings, 0 replies; 39+ messages in thread
From: Daniel Vacek @ 2025-02-26 8:29 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Frank.Li, James.Bottomley, Julia.Lawall, Shyam-sundar.S-k, akpm,
axboe, broonie, cassel, cem, ceph-devel, clm, cocci, dick.kennedy,
djwong, dlemoal, dongsheng.yang, dri-devel, dsterba, eahariha,
festevam, hch, hdegoede, hmh, ibm-acpi-devel, idryomov,
ilpo.jarvinen, imx, james.smart, jgg, josef,
kalesh-anakkur.purayil, kbusch, kernel, leon, linux-arm-kernel,
linux-block, linux-btrfs, linux-ide, linux-kernel, linux-nvme,
linux-pm, linux-rdma, linux-scsi, linux-sound, linux-spi,
linux-xfs, martin.petersen, nicolas.palix, ogabbay, perex,
platform-driver-x86, s.hauer, sagi, selvin.xavier, shawnguo, sre,
tiwai, xiubli, yaron.avizrat
On Wed, 26 Feb 2025 at 09:10, Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> Le 26/02/2025 à 08:28, Daniel Vacek a écrit :
> > On Tue, 25 Feb 2025 at 22:10, Christophe JAILLET
> > <christophe.jaillet-39ZsbGIQGT5GWvitb5QawA@public.gmane.org> wrote:
> >>
> >> Le 25/02/2025 à 21:17, Easwar Hariharan a écrit :
> >>> 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)
> >>>
> >>> @depends on patch@ expression E; @@
> >>>
> >>> -msecs_to_jiffies(E * MSEC_PER_SEC)
> >>> +secs_to_jiffies(E)
> >>>
> >>> While here, remove the no-longer necessary check for range since there's
> >>> no multiplication involved.
> >>
> >> I'm not sure this is correct.
> >> Now you multiply by HZ and things can still overflow.
> >
> > This does not deal with any additional multiplications. If there is an
> > overflow, it was already there before to begin with, IMO.
> >
> >> Hoping I got casting right:
> >
> > Maybe not exactly? See below...
> >
> >> #define MSEC_PER_SEC 1000L
> >> #define HZ 100
> >>
> >>
> >> #define secs_to_jiffies(_secs) (unsigned long)((_secs) * HZ)
> >>
> >> static inline unsigned long _msecs_to_jiffies(const unsigned int m)
> >> {
> >> return (m + (MSEC_PER_SEC / HZ) - 1) / (MSEC_PER_SEC / HZ);
> >> }
> >>
> >> int main() {
> >>
> >> int n = INT_MAX - 5;
> >>
> >> printf("res = %ld\n", secs_to_jiffies(n));
> >> printf("res = %ld\n", _msecs_to_jiffies(1000 * n));
> >
> > I think the format should actually be %lu giving the below results:
> >
> > res = 18446744073709551016
> > res = 429496130
> >
> > Which is still wrong nonetheless. But here, *both* results are wrong
> > as the expected output should be 214748364200 which you'll get with
> > the correct helper/macro.
> >
> > But note another thing, the 1000 * (INT_MAX - 5) already overflows
> > even before calling _msecs_to_jiffies(). See?
>
> Agreed and intentional in my test C code.
>
> That is the point.
>
> The "if (result.uint_32 > INT_MAX / 1000)" in the original code was
> handling such values.
I see. But that was rather an unrelated side-effect. Still you're
right, it needs to be handled carefully not to remove additional
guarantees which were implied unintentionally. At least in places
where these were provided in the first place.
> >
> > Now, you'll get that mentioned correct result with:
> >
> > #define secs_to_jiffies(_secs) ((unsigned long)(_secs) * HZ)
>
> Not looked in details, but I think I would second on you on this, in
> this specific example. Not sure if it would handle all possible uses of
> secs_to_jiffies().
Yeah, I was referring only in context of the example you presented,
not for the rest of the kernel. Sorry about the confusion.
> But it is not how secs_to_jiffies() is defined up to now. See [1].
>
> [1]:
> https://elixir.bootlin.com/linux/v6.14-rc4/source/include/linux/jiffies.h#L540
>
> >
> > Still, why unsigned? What if you wanted to convert -5 seconds to jiffies?
>
> See commit bb2784d9ab495 which added the cast.
Hmmm, fishy. Maybe a function would be better than a macro?
> >
> >> return 0;
> >> }
> >>
> >>
> >> gives :
> >>
> >> res = -600
> >> res = 429496130
> >>
> >> with msec, the previous code would catch the overflow, now it overflows
> >> silently.
> >
> > What compiler options are you using? I'm not getting any warnings.
>
> I mean, with:
> if (result.uint_32 > INT_MAX / 1000)
> goto out_of_range;
> the overflow would be handled *at runtime*.
Got it. But that may still fail if you configure HZ to 5000 or
anything above 1000. Not that anyone should go this way but...
> Without such a check, an unexpected value could be stored in
> opt->lock_timeout.
>
> I think that a test is needed and with secs_to_jiffies(), I tentatively
> proposed:
> if (result.uint_32 > INT_MAX / HZ)
> goto out_of_range;
Right, that should correctly handle any HZ value. Looks good to me.
> CJ
>
> >
> >> untested, but maybe:
> >> if (result.uint_32 > INT_MAX / HZ)
> >> goto out_of_range;
> >>
> >> ?
> >>
> >> CJ
> >>
>
> ...
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH v3 00/16] Converge on using secs_to_jiffies() part two
2025-02-25 20:17 [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Easwar Hariharan
` (16 preceding siblings ...)
2025-02-25 20:30 ` (subset) [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Jens Axboe
@ 2025-02-26 11:29 ` Mark Brown
2025-02-26 20:38 ` Andrew Morton
2025-02-26 16:48 ` (subset) " Mark Brown
2025-03-11 1:19 ` Martin K. Petersen
19 siblings, 1 reply; 39+ messages in thread
From: Mark Brown @ 2025-02-26 11:29 UTC (permalink / raw)
To: Easwar Hariharan
Cc: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky, cocci, linux-kernel, linux-scsi,
dri-devel, linux-sound, linux-btrfs, ceph-devel, linux-block,
linux-ide, linux-xfs, linux-pm, linux-nvme, linux-spi, imx,
linux-arm-kernel, platform-driver-x86, ibm-acpi-devel, linux-rdma,
Takashi Iwai, Carlos Maiolino
[-- Attachment #1: Type: text/plain, Size: 638 bytes --]
On Tue, Feb 25, 2025 at 08:17:14PM +0000, Easwar Hariharan wrote:
> This is the second series (part 1*) that converts users of msecs_to_jiffies() that
> either use the multiply pattern of either of:
> - msecs_to_jiffies(N*1000) or
> - msecs_to_jiffies(N*MSEC_PER_SEC)
>
> where N is a constant or an expression, to avoid the multiplication.
Please don't combine patches for multiple subsystems into a single
series if there's no dependencies between them, it just creates
confusion about how things get merged, problems for tooling and makes
everything more noisy. It's best to split things up per subsystem in
that case.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [cocci] [PATCH v3 04/16] ALSA: ac97: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 ` [PATCH v3 04/16] ALSA: ac97: " Easwar Hariharan
@ 2025-02-26 11:55 ` Markus Elfring
0 siblings, 0 replies; 39+ messages in thread
From: Markus Elfring @ 2025-02-26 11:55 UTC (permalink / raw)
To: Easwar Hariharan, cocci, Andrew Morton, Yaron Avizrat,
Oded Gabbay, Julia Lawall, Nicolas Palix, James Smart,
Dick Kennedy, James E.J. Bottomley, Martin K. Petersen,
Jaroslav Kysela, Takashi Iwai, Chris Mason, Josef Bacik,
David Sterba, Ilya Dryomov, Dongsheng Yang, Jens Axboe, Xiubo Li,
Damien Le Moal, Niklas Cassel, Carlos Maiolino, Darrick J. Wong,
Sebastian Reichel, Keith Busch, Christoph Hellwig, Sagi Grimberg,
Frank Li, Mark Brown, Shawn Guo, Sascha Hauer, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky
Cc: linux-kernel, linux-scsi, dri-devel, linux-sound, linux-btrfs,
ceph-devel, linux-block, linux-ide, linux-xfs, linux-pm,
linux-nvme, linux-spi, imx, linux-arm-kernel, platform-driver-x86,
ibm-acpi-devel, linux-rdma, kernel, Takashi Iwai
…
> This is converted using scripts/coccinelle/misc/secs_to_jiffies.cocci with
> the following Coccinelle rules:
Is only a single SmPL script rule relevant here?
> @depends on patch@
> expression E;
> @@
>
> -msecs_to_jiffies
> +secs_to_jiffies
> (E
> - * \( 1000 \| MSEC_PER_SEC \)
> )
I would miss two space characters in the first text column.
Please avoid typos also in such SmPL code.
Would you like to compare your contributions with a previous change suggestion
like “[PATCH v3 03/16] accel/habanalabs: convert timeouts to secs_to_jiffies()”
once more?
https://lore.kernel.org/cocci/20250225-converge-secs-to-jiffies-part-two-v3-3-a43967e36c88@linux.microsoft.com/
Regards,
Markus
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: (subset) [PATCH v3 00/16] Converge on using secs_to_jiffies() part two
2025-02-25 20:17 [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Easwar Hariharan
` (17 preceding siblings ...)
2025-02-26 11:29 ` Mark Brown
@ 2025-02-26 16:48 ` Mark Brown
2025-03-11 1:19 ` Martin K. Petersen
19 siblings, 0 replies; 39+ messages in thread
From: Mark Brown @ 2025-02-26 16:48 UTC (permalink / raw)
To: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky, Easwar Hariharan
Cc: cocci, linux-kernel, linux-scsi, dri-devel, linux-sound,
linux-btrfs, ceph-devel, linux-block, linux-ide, linux-xfs,
linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Takashi Iwai,
Carlos Maiolino
On Tue, 25 Feb 2025 20:17:14 +0000, Easwar Hariharan wrote:
> This is the second series (part 1*) that converts users of msecs_to_jiffies() that
> either use the multiply pattern of either of:
> - msecs_to_jiffies(N*1000) or
> - msecs_to_jiffies(N*MSEC_PER_SEC)
>
> where N is a constant or an expression, to avoid the multiplication.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[12/16] spi: spi-fsl-lpspi: convert timeouts to secs_to_jiffies()
commit: 32fcd1b9c397ccca7fde2fcbcf4fc7e0ec8f34aa
[13/16] spi: spi-imx: convert timeouts to secs_to_jiffies()
commit: 1d2e01d53a8ebfffb49e8cc656f8c85239121b26
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH v3 00/16] Converge on using secs_to_jiffies() part two
2025-02-26 11:29 ` Mark Brown
@ 2025-02-26 20:38 ` Andrew Morton
2025-02-26 22:26 ` Mark Brown
2025-02-27 9:02 ` Carlos Maiolino
0 siblings, 2 replies; 39+ messages in thread
From: Andrew Morton @ 2025-02-26 20:38 UTC (permalink / raw)
To: Mark Brown
Cc: Easwar Hariharan, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky, cocci, linux-kernel, linux-scsi,
dri-devel, linux-sound, linux-btrfs, ceph-devel, linux-block,
linux-ide, linux-xfs, linux-pm, linux-nvme, linux-spi, imx,
linux-arm-kernel, platform-driver-x86, ibm-acpi-devel, linux-rdma,
Takashi Iwai, Carlos Maiolino
On Wed, 26 Feb 2025 11:29:53 +0000 Mark Brown <broonie@kernel.org> wrote:
> On Tue, Feb 25, 2025 at 08:17:14PM +0000, Easwar Hariharan wrote:
> > This is the second series (part 1*) that converts users of msecs_to_jiffies() that
> > either use the multiply pattern of either of:
> > - msecs_to_jiffies(N*1000) or
> > - msecs_to_jiffies(N*MSEC_PER_SEC)
> >
> > where N is a constant or an expression, to avoid the multiplication.
>
> Please don't combine patches for multiple subsystems into a single
> series if there's no dependencies between them, it just creates
> confusion about how things get merged, problems for tooling and makes
> everything more noisy. It's best to split things up per subsystem in
> that case.
I asked for this. I'll merge everything, spend a few weeks gathering
up maintainer acks. Anything which a subsystem maintainer merges will
be reported by Stephen and I'll drop that particular patch.
This way, nothing gets lost. I take this approach often and it works.
If these were sent as a bunch of individual patches then it would be up
to the sender to keep track of what has been merged and what hasn't.
That person will be resending some stragglers many times. Until they
give up and some patches get permanently lost.
Scale all that across many senders and the whole process becomes costly
and unreliable. Whereas centralizing it on akpm is more efficient,
more reliable, more scalable, lower latency and less frustrating for
senders.
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH v3 00/16] Converge on using secs_to_jiffies() part two
2025-02-26 20:38 ` Andrew Morton
@ 2025-02-26 22:26 ` Mark Brown
2025-02-27 9:02 ` Carlos Maiolino
1 sibling, 0 replies; 39+ messages in thread
From: Mark Brown @ 2025-02-26 22:26 UTC (permalink / raw)
To: Andrew Morton
Cc: Easwar Hariharan, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky, cocci, linux-kernel, linux-scsi,
dri-devel, linux-sound, linux-btrfs, ceph-devel, linux-block,
linux-ide, linux-xfs, linux-pm, linux-nvme, linux-spi, imx,
linux-arm-kernel, platform-driver-x86, ibm-acpi-devel, linux-rdma,
Takashi Iwai, Carlos Maiolino
[-- Attachment #1: Type: text/plain, Size: 2310 bytes --]
On Wed, Feb 26, 2025 at 12:38:51PM -0800, Andrew Morton wrote:
> On Wed, 26 Feb 2025 11:29:53 +0000 Mark Brown <broonie@kernel.org> wrote:
> > Please don't combine patches for multiple subsystems into a single
> > series if there's no dependencies between them, it just creates
> > confusion about how things get merged, problems for tooling and makes
> > everything more noisy. It's best to split things up per subsystem in
> > that case.
> I asked for this. I'll merge everything, spend a few weeks gathering
> up maintainer acks. Anything which a subsystem maintainer merges will
> be reported by Stephen and I'll drop that particular patch.
> This way, nothing gets lost. I take this approach often and it works.
I've only started seeing these in the past few weeks, but we do have a
bunch of people routinely doing cross tree stuff who split things up and
it seems to work OK there.
> If these were sent as a bunch of individual patches then it would be up
> to the sender to keep track of what has been merged and what hasn't.
> That person will be resending some stragglers many times. Until they
> give up and some patches get permanently lost.
Surely the sender can just CC you on each individual thing just as well?
Ensuring things get picked up is great, but it's not clear to me that
copying everyone on a cross tree series is helping with that.
> Scale all that across many senders and the whole process becomes costly
> and unreliable. Whereas centralizing it on akpm is more efficient,
> more reliable, more scalable, lower latency and less frustrating for
> senders.
Whereas copying everyone means all the maintainers see something that
looks terribly complicated in their inboxes and have to figure out if
there are actually any dependencies in the series and how it's supposed
to be handed, and then every reply goes to a huge CC list. That's not
good for either getting people to look at things or general noise
avoidance, especially for people who are expecting to get cross tree
serieses which do have dependencies that need to be managed.
There's also some bad failure modes as soon as anyone has any sort of
comment on the series, suddenly everyone's got a coding style debate or
whatever in their inboxes they can pile into.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH v3 00/16] Converge on using secs_to_jiffies() part two
2025-02-26 20:38 ` Andrew Morton
2025-02-26 22:26 ` Mark Brown
@ 2025-02-27 9:02 ` Carlos Maiolino
1 sibling, 0 replies; 39+ messages in thread
From: Carlos Maiolino @ 2025-02-27 9:02 UTC (permalink / raw)
To: Andrew Morton
Cc: Mark Brown, Easwar Hariharan, Yaron Avizrat, Oded Gabbay,
Julia Lawall, Nicolas Palix, James Smart, Dick Kennedy,
James E.J. Bottomley, Martin K. Petersen, Jaroslav Kysela,
Takashi Iwai, Chris Mason, Josef Bacik, David Sterba,
Ilya Dryomov, Dongsheng Yang, Jens Axboe, Xiubo Li,
Damien Le Moal, Niklas Cassel, Darrick J. Wong, Sebastian Reichel,
Keith Busch, Christoph Hellwig, Sagi Grimberg, Frank Li,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky, cocci, linux-kernel, linux-scsi,
dri-devel, linux-sound, linux-btrfs, ceph-devel, linux-block,
linux-ide, linux-xfs, linux-pm, linux-nvme, linux-spi, imx,
linux-arm-kernel, platform-driver-x86, ibm-acpi-devel, linux-rdma,
Takashi Iwai, Carlos Maiolino
On Wed, Feb 26, 2025 at 12:38:51PM -0800, Andrew Morton wrote:
> On Wed, 26 Feb 2025 11:29:53 +0000 Mark Brown <broonie@kernel.org> wrote:
>
> > On Tue, Feb 25, 2025 at 08:17:14PM +0000, Easwar Hariharan wrote:
> > > This is the second series (part 1*) that converts users of msecs_to_jiffies() that
> > > either use the multiply pattern of either of:
> > > - msecs_to_jiffies(N*1000) or
> > > - msecs_to_jiffies(N*MSEC_PER_SEC)
> > >
> > > where N is a constant or an expression, to avoid the multiplication.
> >
> > Please don't combine patches for multiple subsystems into a single
> > series if there's no dependencies between them, it just creates
> > confusion about how things get merged, problems for tooling and makes
> > everything more noisy. It's best to split things up per subsystem in
> > that case.
>
> I asked for this. I'll merge everything, spend a few weeks gathering
> up maintainer acks. Anything which a subsystem maintainer merges will
> be reported by Stephen and I'll drop that particular patch.
I'm removing this from my queue then and let it go through your tree.
Cheers,
Carlos
>
> This way, nothing gets lost. I take this approach often and it works.
>
> If these were sent as a bunch of individual patches then it would be up
> to the sender to keep track of what has been merged and what hasn't.
> That person will be resending some stragglers many times. Until they
> give up and some patches get permanently lost.
>
> Scale all that across many senders and the whole process becomes costly
> and unreliable. Whereas centralizing it on akpm is more efficient,
> more reliable, more scalable, lower latency and less frustrating for
> senders.
>
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH v3 02/16] scsi: lpfc: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 ` [PATCH v3 02/16] scsi: lpfc: convert timeouts to secs_to_jiffies() Easwar Hariharan
@ 2025-03-04 2:11 ` Martin K. Petersen
0 siblings, 0 replies; 39+ messages in thread
From: Martin K. Petersen @ 2025-03-04 2:11 UTC (permalink / raw)
To: Easwar Hariharan
Cc: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky, cocci, linux-kernel, linux-scsi,
dri-devel, linux-sound, linux-btrfs, ceph-devel, linux-block,
linux-ide, linux-xfs, linux-pm, linux-nvme, linux-spi, imx,
linux-arm-kernel, platform-driver-x86, ibm-acpi-devel, linux-rdma
Easwar,
> 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
Fixed compilation error and applied to 6.15/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: (subset) [PATCH v3 00/16] Converge on using secs_to_jiffies() part two
2025-02-25 20:17 [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Easwar Hariharan
` (18 preceding siblings ...)
2025-02-26 16:48 ` (subset) " Mark Brown
@ 2025-03-11 1:19 ` Martin K. Petersen
2025-03-11 2:08 ` Andrew Morton
19 siblings, 1 reply; 39+ messages in thread
From: Martin K. Petersen @ 2025-03-11 1:19 UTC (permalink / raw)
To: Andrew Morton, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Jaroslav Kysela, Takashi Iwai, Chris Mason, Josef Bacik,
David Sterba, Ilya Dryomov, Dongsheng Yang, Jens Axboe, Xiubo Li,
Damien Le Moal, Niklas Cassel, Carlos Maiolino, Darrick J. Wong,
Sebastian Reichel, Keith Busch, Christoph Hellwig, Sagi Grimberg,
Frank Li, Mark Brown, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Shyam Sundar S K,
Hans de Goede, Ilpo Järvinen, Henrique de Moraes Holschuh,
Selvin Xavier, Kalesh AP, Jason Gunthorpe, Leon Romanovsky,
Easwar Hariharan
Cc: Martin K . Petersen, cocci, linux-kernel, linux-scsi, dri-devel,
linux-sound, linux-btrfs, ceph-devel, linux-block, linux-ide,
linux-xfs, linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Takashi Iwai,
Carlos Maiolino
On Tue, 25 Feb 2025 20:17:14 +0000, Easwar Hariharan wrote:
> This is the second series (part 1*) that converts users of msecs_to_jiffies() that
> either use the multiply pattern of either of:
> - msecs_to_jiffies(N*1000) or
> - msecs_to_jiffies(N*MSEC_PER_SEC)
>
> where N is a constant or an expression, to avoid the multiplication.
>
> [...]
Applied to 6.15/scsi-queue, thanks!
[02/16] scsi: lpfc: convert timeouts to secs_to_jiffies()
https://git.kernel.org/mkp/scsi/c/a131f20804d6
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: (subset) [PATCH v3 00/16] Converge on using secs_to_jiffies() part two
2025-03-11 1:19 ` Martin K. Petersen
@ 2025-03-11 2:08 ` Andrew Morton
2025-03-11 2:29 ` Martin K. Petersen
0 siblings, 1 reply; 39+ messages in thread
From: Andrew Morton @ 2025-03-11 2:08 UTC (permalink / raw)
To: Martin K. Petersen
Cc: Yaron Avizrat, Oded Gabbay, Julia Lawall, Nicolas Palix,
James Smart, Dick Kennedy, James E.J. Bottomley, Jaroslav Kysela,
Takashi Iwai, Chris Mason, Josef Bacik, David Sterba,
Ilya Dryomov, Dongsheng Yang, Jens Axboe, Xiubo Li,
Damien Le Moal, Niklas Cassel, Carlos Maiolino, Darrick J. Wong,
Sebastian Reichel, Keith Busch, Christoph Hellwig, Sagi Grimberg,
Frank Li, Mark Brown, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Shyam Sundar S K,
Hans de Goede, Ilpo Järvinen, Henrique de Moraes Holschuh,
Selvin Xavier, Kalesh AP, Jason Gunthorpe, Leon Romanovsky,
Easwar Hariharan, cocci, linux-kernel, linux-scsi, dri-devel,
linux-sound, linux-btrfs, ceph-devel, linux-block, linux-ide,
linux-xfs, linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Takashi Iwai,
Carlos Maiolino
On Mon, 10 Mar 2025 21:19:03 -0400 "Martin K. Petersen" <martin.petersen@oracle.com> wrote:
> On Tue, 25 Feb 2025 20:17:14 +0000, Easwar Hariharan wrote:
>
> > This is the second series (part 1*) that converts users of msecs_to_jiffies() that
> > either use the multiply pattern of either of:
> > - msecs_to_jiffies(N*1000) or
> > - msecs_to_jiffies(N*MSEC_PER_SEC)
> >
> > where N is a constant or an expression, to avoid the multiplication.
> >
> > [...]
>
> Applied to 6.15/scsi-queue, thanks!
>
> [02/16] scsi: lpfc: convert timeouts to secs_to_jiffies()
> https://git.kernel.org/mkp/scsi/c/a131f20804d6
Really, an acked-by would have been much easier all around, but whatever.
Did you get my fix?
From: Andrew Morton <akpm@linux-foundation.org>
Subject: scsi-lpfc-convert-timeouts-to-secs_to_jiffies-fix
Date: Tue Feb 25 07:32:03 PM PST 2025
fix build
Cc: Easwar Hariharan <eahariha@linux.microsoft.com>
Cc: James Bottomley <james.bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/scsi/lpfc/lpfc_sli.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/scsi/lpfc/lpfc_sli.c~scsi-lpfc-convert-timeouts-to-secs_to_jiffies-fix
+++ a/drivers/scsi/lpfc/lpfc_sli.c
@@ -3954,7 +3954,7 @@ void lpfc_poll_eratt(struct timer_list *
else
/* Restart the timer for next eratt poll */
mod_timer(&phba->eratt_poll,
- jiffies + secs_to_jiffies(phba->eratt_poll_interval);
+ jiffies + secs_to_jiffies(phba->eratt_poll_interval));
return;
}
_
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: (subset) [PATCH v3 00/16] Converge on using secs_to_jiffies() part two
2025-03-11 2:08 ` Andrew Morton
@ 2025-03-11 2:29 ` Martin K. Petersen
0 siblings, 0 replies; 39+ messages in thread
From: Martin K. Petersen @ 2025-03-11 2:29 UTC (permalink / raw)
To: Andrew Morton
Cc: Martin K. Petersen, Yaron Avizrat, Oded Gabbay, Julia Lawall,
Nicolas Palix, James Smart, Dick Kennedy, James E.J. Bottomley,
Jaroslav Kysela, Takashi Iwai, Chris Mason, Josef Bacik,
David Sterba, Ilya Dryomov, Dongsheng Yang, Jens Axboe, Xiubo Li,
Damien Le Moal, Niklas Cassel, Carlos Maiolino, Darrick J. Wong,
Sebastian Reichel, Keith Busch, Christoph Hellwig, Sagi Grimberg,
Frank Li, Mark Brown, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Shyam Sundar S K,
Hans de Goede, Ilpo Järvinen, Henrique de Moraes Holschuh,
Selvin Xavier, Kalesh AP, Jason Gunthorpe, Leon Romanovsky,
Easwar Hariharan, cocci, linux-kernel, linux-scsi, dri-devel,
linux-sound, linux-btrfs, ceph-devel, linux-block, linux-ide,
linux-xfs, linux-pm, linux-nvme, linux-spi, imx, linux-arm-kernel,
platform-driver-x86, ibm-acpi-devel, linux-rdma, Takashi Iwai,
Carlos Maiolino
Hi Andrew!
> Really, an acked-by would have been much easier all around, but
> whatever.
Hard to keep track of which of these kernel-wide series go through one
tree and which ones don't. I generally err on the side of picking up
things which may conflict with driver updates in my tree.
Judging by the commit message, I did notice the missing parenthesis.
Thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH v3 15/16] platform/x86: thinkpad_acpi: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 ` [PATCH v3 15/16] platform/x86: thinkpad_acpi: " Easwar Hariharan
@ 2025-03-21 16:06 ` Ilpo Järvinen
0 siblings, 0 replies; 39+ messages in thread
From: Ilpo Järvinen @ 2025-03-21 16:06 UTC (permalink / raw)
To: Easwar Hariharan, Andrew Morton
Cc: Yaron Avizrat, Oded Gabbay, Julia Lawall, Nicolas Palix,
James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Henrique de Moraes Holschuh,
Selvin Xavier, Kalesh AP, Jason Gunthorpe, Leon Romanovsky, cocci,
LKML, linux-scsi, dri-devel, linux-sound, linux-btrfs, ceph-devel,
linux-block, linux-ide, linux-xfs, linux-pm, linux-nvme,
linux-spi, imx, linux-arm-kernel, platform-driver-x86,
ibm-acpi-devel, linux-rdma
On Tue, 25 Feb 2025, Easwar Hariharan wrote:
> 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
> +secs_to_jiffies
> (E
> - * \( 1000 \| MSEC_PER_SEC \)
> )
>
> Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
Applied to the review-ilpo-next branch.
> ---
> drivers/platform/x86/thinkpad_acpi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
> index ab1cade5ef231e9a9a520bc0cca82384c911a331..d269e791f7fbc2a8ccf96f28cb476beccb57c9a7 100644
> --- a/drivers/platform/x86/thinkpad_acpi.c
> +++ b/drivers/platform/x86/thinkpad_acpi.c
> @@ -8512,7 +8512,7 @@ static void fan_watchdog_reset(void)
> if (fan_watchdog_maxinterval > 0 &&
> tpacpi_lifecycle != TPACPI_LIFE_EXITING)
> mod_delayed_work(tpacpi_wq, &fan_watchdog_task,
> - msecs_to_jiffies(fan_watchdog_maxinterval * 1000));
> + secs_to_jiffies(fan_watchdog_maxinterval));
> else
> cancel_delayed_work(&fan_watchdog_task);
> }
--
i.
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [PATCH v3 14/16] platform/x86/amd/pmf: convert timeouts to secs_to_jiffies()
2025-02-25 20:17 ` [PATCH v3 14/16] platform/x86/amd/pmf: " Easwar Hariharan
@ 2025-03-21 16:08 ` Ilpo Järvinen
0 siblings, 0 replies; 39+ messages in thread
From: Ilpo Järvinen @ 2025-03-21 16:08 UTC (permalink / raw)
To: Easwar Hariharan, Andrew Morton
Cc: Yaron Avizrat, Oded Gabbay, Julia Lawall, Nicolas Palix,
James Smart, Dick Kennedy, James E.J. Bottomley,
Martin K. Petersen, Jaroslav Kysela, Takashi Iwai, Chris Mason,
Josef Bacik, David Sterba, Ilya Dryomov, Dongsheng Yang,
Jens Axboe, Xiubo Li, Damien Le Moal, Niklas Cassel,
Carlos Maiolino, Darrick J. Wong, Sebastian Reichel, Keith Busch,
Christoph Hellwig, Sagi Grimberg, Frank Li, Mark Brown, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Shyam Sundar S K, Hans de Goede, Ilpo Järvinen,
Henrique de Moraes Holschuh, Selvin Xavier, Kalesh AP,
Jason Gunthorpe, Leon Romanovsky, cocci, LKML, linux-scsi,
dri-devel, linux-sound, linux-btrfs, ceph-devel, linux-block,
linux-ide, linux-xfs, linux-pm, linux-nvme, linux-spi, imx,
linux-arm-kernel, platform-driver-x86, ibm-acpi-devel, linux-rdma
On Tue, 25 Feb 2025, Easwar Hariharan wrote:
> 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
> +secs_to_jiffies
> (E
> - * \( 1000 \| MSEC_PER_SEC \)
> )
>
> Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
Applied to the review-ilpo-next branch.
> ---
> drivers/platform/x86/amd/pmf/acpi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/amd/pmf/acpi.c b/drivers/platform/x86/amd/pmf/acpi.c
> index dd5780a1d06e1dc979fcff5bafd6729bc4937eab..f75f7ecd8cd91c9d55abc38ce6e46eed7fe69fc0 100644
> --- a/drivers/platform/x86/amd/pmf/acpi.c
> +++ b/drivers/platform/x86/amd/pmf/acpi.c
> @@ -220,7 +220,7 @@ static void apmf_sbios_heartbeat_notify(struct work_struct *work)
> if (!info)
> return;
>
> - schedule_delayed_work(&dev->heart_beat, msecs_to_jiffies(dev->hb_interval * 1000));
> + schedule_delayed_work(&dev->heart_beat, secs_to_jiffies(dev->hb_interval));
> kfree(info);
> }
>
>
>
--
i.
^ permalink raw reply [flat|nested] 39+ messages in thread
end of thread, other threads:[~2025-03-21 16:09 UTC | newest]
Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-25 20:17 [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Easwar Hariharan
2025-02-25 20:17 ` [PATCH v3 01/16] coccinelle: misc: secs_to_jiffies: Patch expressions too Easwar Hariharan
2025-02-25 20:17 ` [PATCH v3 02/16] scsi: lpfc: convert timeouts to secs_to_jiffies() Easwar Hariharan
2025-03-04 2:11 ` Martin K. Petersen
2025-02-25 20:17 ` [PATCH v3 03/16] accel/habanalabs: " Easwar Hariharan
2025-02-25 20:17 ` [PATCH v3 04/16] ALSA: ac97: " Easwar Hariharan
2025-02-26 11:55 ` [cocci] " Markus Elfring
2025-02-25 20:17 ` [PATCH v3 05/16] btrfs: " Easwar Hariharan
2025-02-25 20:17 ` [PATCH v3 06/16] rbd: " Easwar Hariharan
2025-02-25 21:09 ` Christophe JAILLET
2025-02-26 0:02 ` Easwar Hariharan
2025-02-26 7:28 ` Daniel Vacek
2025-02-26 8:10 ` Christophe JAILLET
2025-02-26 8:29 ` Daniel Vacek
2025-02-25 20:17 ` [PATCH v3 07/16] libceph: " Easwar Hariharan
2025-02-25 21:25 ` Christophe JAILLET
2025-02-25 20:17 ` [PATCH v3 08/16] ata: libata-zpodd: " Easwar Hariharan
2025-02-25 20:24 ` Easwar Hariharan
2025-02-26 2:00 ` Damien Le Moal
2025-02-25 20:17 ` [PATCH v3 09/16] xfs: " Easwar Hariharan
2025-02-25 20:17 ` [PATCH v3 10/16] power: supply: da9030: " Easwar Hariharan
2025-02-25 20:17 ` [PATCH v3 11/16] nvme: " Easwar Hariharan
2025-02-25 20:17 ` [PATCH v3 12/16] spi: spi-fsl-lpspi: " Easwar Hariharan
2025-02-25 20:17 ` [PATCH v3 13/16] spi: spi-imx: " Easwar Hariharan
2025-02-25 20:27 ` Marc Kleine-Budde
2025-02-25 20:17 ` [PATCH v3 14/16] platform/x86/amd/pmf: " Easwar Hariharan
2025-03-21 16:08 ` Ilpo Järvinen
2025-02-25 20:17 ` [PATCH v3 15/16] platform/x86: thinkpad_acpi: " Easwar Hariharan
2025-03-21 16:06 ` Ilpo Järvinen
2025-02-25 20:17 ` [PATCH v3 16/16] RDMA/bnxt_re: " Easwar Hariharan
2025-02-25 20:30 ` (subset) [PATCH v3 00/16] Converge on using secs_to_jiffies() part two Jens Axboe
2025-02-26 11:29 ` Mark Brown
2025-02-26 20:38 ` Andrew Morton
2025-02-26 22:26 ` Mark Brown
2025-02-27 9:02 ` Carlos Maiolino
2025-02-26 16:48 ` (subset) " Mark Brown
2025-03-11 1:19 ` Martin K. Petersen
2025-03-11 2:08 ` Andrew Morton
2025-03-11 2:29 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).