On 2/15/2022 4:02 PM, Jason A. Donenfeld wrote:
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@xxxxxxxxxx>
Cc: Kalle Valo <kvalo@xxxxxxxxxx>
Cc: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>
Cc: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Jason A. Donenfeld <Jason@xxxxxxxxx>
---
[snip]
if (!AR_SREV_9300_20_OR_LATER(ah))
return;
- sc->rng_task = kthread_run(ath9k_rng_kthread, sc, "ath9k-hwrng");
- if (IS_ERR(sc->rng_task))
- sc->rng_task = NULL;
+ sc->rng_ops.name = "ath9k";
You will have to give this instance an unique name because there can be
multiple ath9k adapters registered in a given system (like Wi-Fi
routers), and one of the first thing hwrng_register() does is ensure
that there is not an existing rng with the same name.
Maybe using a combination of ath9k + dev_name() ought to be unique enough?
--
Florian