Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __DRM_RANDOM_H__
0003 #define __DRM_RANDOM_H__
0004 
0005 /* This is a temporary home for a couple of utility functions that should
0006  * be transposed to lib/ at the earliest convenience.
0007  */
0008 
0009 #include <linux/random.h>
0010 
0011 #define DRM_RND_STATE_INITIALIZER(seed__) ({                \
0012     struct rnd_state state__;                   \
0013     prandom_seed_state(&state__, (seed__));             \
0014     state__;                            \
0015 })
0016 
0017 #define DRM_RND_STATE(name__, seed__) \
0018     struct rnd_state name__ = DRM_RND_STATE_INITIALIZER(seed__)
0019 
0020 unsigned int *drm_random_order(unsigned int count,
0021                    struct rnd_state *state);
0022 void drm_random_reorder(unsigned int *order,
0023             unsigned int count,
0024             struct rnd_state *state);
0025 u32 drm_prandom_u32_max_state(u32 ep_ro,
0026                   struct rnd_state *state);
0027 
0028 #endif /* !__DRM_RANDOM_H__ */