drm_random.h 680 B

12345678910111213141516171819202122232425
  1. #ifndef __DRM_RANDOM_H__
  2. #define __DRM_RANDOM_H__
  3. /* This is a temporary home for a couple of utility functions that should
  4. * be transposed to lib/ at the earliest convenience.
  5. */
  6. #include <linux/random.h>
  7. #define DRM_RND_STATE_INITIALIZER(seed__) ({ \
  8. struct rnd_state state__; \
  9. prandom_seed_state(&state__, (seed__)); \
  10. state__; \
  11. })
  12. #define DRM_RND_STATE(name__, seed__) \
  13. struct rnd_state name__ = DRM_RND_STATE_INITIALIZER(seed__)
  14. unsigned int *drm_random_order(unsigned int count,
  15. struct rnd_state *state);
  16. void drm_random_reorder(unsigned int *order,
  17. unsigned int count,
  18. struct rnd_state *state);
  19. #endif /* !__DRM_RANDOM_H__ */