Re: [PATCH 11/16] nvme: convert timeouts to secs_to_jiffies()

Keith Busch
2025-01-28T19:01:04Z

On Tue, Jan 28, 2025 at 06:21:56PM +0000, 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>
> ---
> 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 76b615d4d5b91e163e5a6e7baf451c959a2c3cab..87498215ede4bcaf48660b89c901075dfcfaf041 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -4459,11 +4459,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)) {
>
> --

Acked-by: Keith Busch <kbusch@kernel.org>