Re: [PATCH v2] ath9k: sleep for less time when unregistering hwrng

From: Herbert Xu
Date: Mon Jun 27 2022 - 02:45:14 EST


On Fri, Jun 24, 2022 at 10:44:33PM +0200, Jason A. Donenfeld wrote:
.
> diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
> index 16f227b995e8..af1c1905bb7e 100644
> --- a/drivers/char/hw_random/core.c
> +++ b/drivers/char/hw_random/core.c
> @@ -513,8 +513,13 @@ static int hwrng_fillfn(void *unused)
> break;
>
> if (rc <= 0) {
> - pr_warn("hwrng: no data available\n");
> - msleep_interruptible(10000);
> + int i;
> +
> + for (i = 0; i < 100; ++i) {
> + if (kthread_should_stop() ||
> + msleep_interruptible(10000 / 100))
> + goto out;
> + }

Please use schedule_timeout_interruptible. But if you're going
to make it interruptible it should probably at least try to do
something about signals rather than just ignore them.

Cheers,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt