diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-07-04 09:12:50 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-07-04 09:12:50 +0200 |
commit | f68d891d85c8f9ab1af663ed3ceac18ad58dbabe (patch) | |
tree | d92db7af512307ab5282eb62f3dd1741ac71d21f /drivers/char/hw_random/atmel-rng.c | |
parent | 5780b627e24113323427c102175296ae43dfb9d7 (diff) | |
parent | 3fd877d32cac31292628fb8f443543fc1989b49b (diff) |
Merge branch 'topic/hda-beep' into topic/hda
Diffstat (limited to 'drivers/char/hw_random/atmel-rng.c')
-rw-r--r-- | drivers/char/hw_random/atmel-rng.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c index f518b99f53f5..731c9046cf7b 100644 --- a/drivers/char/hw_random/atmel-rng.c +++ b/drivers/char/hw_random/atmel-rng.c @@ -34,8 +34,15 @@ static int atmel_trng_read(struct hwrng *rng, void *buf, size_t max, u32 *data = buf; /* data ready? */ - if (readl(trng->base + TRNG_ODATA) & 1) { + if (readl(trng->base + TRNG_ISR) & 1) { *data = readl(trng->base + TRNG_ODATA); + /* + ensure data ready is only set again AFTER the next data + word is ready in case it got set between checking ISR + and reading ODATA, so we don't risk re-reading the + same word + */ + readl(trng->base + TRNG_ISR); return 4; } else return 0; |