1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __DRM_RANDOM_H__
3 #define __DRM_RANDOM_H__
5 /* This is a temporary home for a couple of utility functions that should
6 * be transposed to lib/ at the earliest convenience.
9 #include <linux/random.h>
11 #define DRM_RND_STATE_INITIALIZER(seed__) ({ \
12 struct rnd_state state__; \
13 prandom_seed_state(&state__, (seed__)); \
17 #define DRM_RND_STATE(name__, seed__) \
18 struct rnd_state name__ = DRM_RND_STATE_INITIALIZER(seed__)
20 unsigned int *drm_random_order(unsigned int count,
21 struct rnd_state *state);
22 void drm_random_reorder(unsigned int *order,
24 struct rnd_state *state);
25 u32 drm_prandom_u32_max_state(u32 ep_ro,
26 struct rnd_state *state);
28 #endif /* !__DRM_RANDOM_H__ */