[PATCH] hwrng: Use us_to_ktime() where appropriate

Xichao Zhao posted 1 patch 2 months ago
drivers/char/hw_random/timeriomem-rng.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] hwrng: Use us_to_ktime() where appropriate
Posted by Xichao Zhao 2 months ago
It is better to replace ns_to_ktime() with us_to_ktime(),
which can make the code clearer.

Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
 drivers/char/hw_random/timeriomem-rng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/timeriomem-rng.c b/drivers/char/hw_random/timeriomem-rng.c
index b95f6d0f17ed..e61f06393209 100644
--- a/drivers/char/hw_random/timeriomem-rng.c
+++ b/drivers/char/hw_random/timeriomem-rng.c
@@ -150,7 +150,7 @@ static int timeriomem_rng_probe(struct platform_device *pdev)
 		priv->rng_ops.quality = pdata->quality;
 	}
 
-	priv->period = ns_to_ktime(period * NSEC_PER_USEC);
+	priv->period = us_to_ktime(period);
 	init_completion(&priv->completion);
 	hrtimer_setup(&priv->timer, timeriomem_rng_trigger, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
 
-- 
2.34.1
Re: [PATCH] hwrng: Use us_to_ktime() where appropriate
Posted by Herbert Xu 1 month, 2 weeks ago
On Thu, Jul 31, 2025 at 08:17:27PM +0800, Xichao Zhao wrote:
> It is better to replace ns_to_ktime() with us_to_ktime(),
> which can make the code clearer.
> 
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
> ---
>  drivers/char/hw_random/timeriomem-rng.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt