[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87mtir9xrq.fsf@tynnyri.adurom.net>
Date: Wed, 16 Feb 2022 07:38:17 +0200
From: Kalle Valo <kvalo@...nel.org>
To: "Jason A. Donenfeld" <Jason@...c4.com>
Cc: miaoqing@...eaurora.org, rsalvaterra@...il.com,
Toke Høiland-Jørgensen
<toke@...e.dk>, "Sepehrdad\, Pouyan" <pouyans@....qualcomm.com>,
ath9k-devel <ath9k-devel@....qualcomm.com>,
"linux-wireless\@vger.kernel.org" <linux-wireless@...r.kernel.org>,
Dominik Brodowski <linux@...inikbrodowski.net>,
Linux Crypto Mailing List <linux-crypto@...r.kernel.org>,
Herbert Xu <herbert@...dor.apana.org.au>,
LKML <linux-kernel@...r.kernel.org>,
Netdev <netdev@...r.kernel.org>,
Toke Høiland-Jørgensen <toke@...hat.com>
Subject: Re: [PATCH v2] ath9k: use hw_random API instead of directly dumping into random.c
"Jason A. Donenfeld" <Jason@...c4.com> writes:
> Hardware random number generators are supposed to use the hw_random
> framework. This commit turns ath9k's kthread-based design into a proper
> hw_random driver.
>
> This compiles, but I have no hardware or other ability to determine
> whether it works. I'll leave further development up to the ath9k
> and hw_random maintainers.
>
> Cc: Toke Høiland-Jørgensen <toke@...hat.com>
> Cc: Kalle Valo <kvalo@...nel.org>
> Cc: Dominik Brodowski <linux@...inikbrodowski.net>
> Cc: Herbert Xu <herbert@...dor.apana.org.au>
> Signed-off-by: Jason A. Donenfeld <Jason@...c4.com>
[...]
> +retry:
> + if (max & ~3UL)
> + bytes_read = ath9k_rng_data_read(sc, buf, max >> 2);
> + if ((max & 3UL) && ath9k_rng_data_read(sc, &word, 1)) {
> + memcpy(buf + bytes_read, &word, max & 3);
> + bytes_read += max & 3;
> + memzero_explicit(&word, sizeof(word));
> + }
> + if (max && unlikely(!bytes_read) && wait) {
> + msleep(ath9k_rng_delay_get(++fail_stats));
> + goto retry;
> }
Wouldn't a while loop be cleaner? With a some kind limit for the number
of loops, to avoid a neverending loop.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Powered by blists - more mailing lists