diff options
| author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-06-30 12:16:24 +0200 |
|---|---|---|
| committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-07-26 14:27:25 +0200 |
| commit | 2dcf78c0eeae3bd07082821557014f25f02ca2e9 (patch) | |
| tree | 8ca5c4c7f35c9a9ab07fcd9732124c905e609aa1 /include/linux/random.h | |
| parent | 6b6322676add0fa2713d0ec89a28390fd4d907f5 (diff) | |
| parent | 5109a4597f7e758b8d20694392d0361a0b4c43b1 (diff) | |
Merge branch 'imx/for-2.6.36' of git://git.pengutronix.de/git/ukl/linux-2.6 into HEAD
There are some more conflicts than detected by git, namely support for
the newly added cpuimx machines needed to be converted to dynamic device
registration.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Conflicts:
arch/arm/mach-imx/Makefile
arch/arm/mach-imx/devices.c
arch/arm/mach-imx/devices.h
arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
arch/arm/mach-mx2/Kconfig
arch/arm/mach-mx25/Makefile
arch/arm/mach-mx25/devices.c
arch/arm/plat-mxc/include/mach/mx25.h
arch/arm/plat-mxc/include/mach/mxc_nand.h
Diffstat (limited to 'include/linux/random.h')
| -rw-r--r-- | include/linux/random.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/linux/random.h b/include/linux/random.h index 25d02fe5c9b5..fb7ab9de5f36 100644 --- a/include/linux/random.h +++ b/include/linux/random.h @@ -40,6 +40,10 @@ struct rand_pool_info { __u32 buf[0]; }; +struct rnd_state { + __u32 s1, s2, s3; +}; + /* Exported functions */ #ifdef __KERNEL__ @@ -74,6 +78,30 @@ unsigned long randomize_range(unsigned long start, unsigned long end, unsigned l u32 random32(void); void srandom32(u32 seed); +u32 prandom32(struct rnd_state *); + +/* + * Handle minimum values for seeds + */ +static inline u32 __seed(u32 x, u32 m) +{ + return (x < m) ? x + m : x; +} + +/** + * prandom32_seed - set seed for prandom32(). + * @state: pointer to state structure to receive the seed. + * @seed: arbitrary 64-bit value to use as a seed. + */ +static inline void prandom32_seed(struct rnd_state *state, u64 seed) +{ + u32 i = (seed >> 32) ^ (seed << 10) ^ seed; + + state->s1 = __seed(i, 1); + state->s2 = __seed(i, 7); + state->s3 = __seed(i, 15); +} + #endif /* __KERNEL___ */ #endif /* _LINUX_RANDOM_H */ |
