You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[HWRNG]: move status polling loop to data_present callbacks
Handle waiting for new random within the drivers themselves, this allows to use better suited timeouts for the individual rngs. Signed-off-by: Patrick McHardy <kaber@trash.net> Acked-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
committed by
Herbert Xu
parent
2407d60872
commit
984e976f53
@@ -29,6 +29,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/stop_machine.h>
|
||||
#include <linux/delay.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
|
||||
@@ -162,11 +163,19 @@ static inline u8 hwstatus_set(void __iomem *mem,
|
||||
return hwstatus_get(mem);
|
||||
}
|
||||
|
||||
static int intel_rng_data_present(struct hwrng *rng)
|
||||
static int intel_rng_data_present(struct hwrng *rng, int wait)
|
||||
{
|
||||
void __iomem *mem = (void __iomem *)rng->priv;
|
||||
int data, i;
|
||||
|
||||
return !!(readb(mem + INTEL_RNG_STATUS) & INTEL_RNG_DATA_PRESENT);
|
||||
for (i = 0; i < 20; i++) {
|
||||
data = !!(readb(mem + INTEL_RNG_STATUS) &
|
||||
INTEL_RNG_DATA_PRESENT);
|
||||
if (data || !wait)
|
||||
break;
|
||||
udelay(10);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
static int intel_rng_data_read(struct hwrng *rng, u32 *data)
|
||||
|
||||
Reference in New Issue
Block a user