lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jcEX=sxK9kEo-jTX-e1cGi6RqLTG6OjmGdaqWNNwV_4w@mail.gmail.com>
Date: Thu, 21 Aug 2025 21:59:50 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Xichao Zhao <zhao.xichao@...o.com>
Cc: rafael@...nel.org, linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] powercap: use us_to_ktime() where appropriate

On Wed, Aug 13, 2025 at 9:54 AM Xichao Zhao <zhao.xichao@...o.com> wrote:
>
> The duration_us, idle_duration_us, and run_duration_us are more suitable
> for using the us_to_ktime() function. This can make the code more concise
> and enhance readability.
>
> Signed-off-by: Xichao Zhao <zhao.xichao@...o.com>
> ---
>  drivers/powercap/idle_inject.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/powercap/idle_inject.c b/drivers/powercap/idle_inject.c
> index 5ad7cc438068..a25eb2018acd 100644
> --- a/drivers/powercap/idle_inject.c
> +++ b/drivers/powercap/idle_inject.c
> @@ -133,7 +133,7 @@ static enum hrtimer_restart idle_inject_timer_fn(struct hrtimer *timer)
>         duration_us = READ_ONCE(ii_dev->run_duration_us);
>         duration_us += READ_ONCE(ii_dev->idle_duration_us);
>
> -       hrtimer_forward_now(timer, ns_to_ktime(duration_us * NSEC_PER_USEC));
> +       hrtimer_forward_now(timer, us_to_ktime(duration_us));
>
>         return HRTIMER_RESTART;
>  }
> @@ -232,8 +232,7 @@ int idle_inject_start(struct idle_inject_device *ii_dev)
>         idle_inject_wakeup(ii_dev);
>
>         hrtimer_start(&ii_dev->timer,
> -                     ns_to_ktime((idle_duration_us + run_duration_us) *
> -                                 NSEC_PER_USEC),
> +                     us_to_ktime(idle_duration_us + run_duration_us),
>                       HRTIMER_MODE_REL);
>
>         return 0;
> --

Applied as 6.18 material with adjusted subject and changelog, thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ