Skip to content

Commit efa6fbd

Browse files
thilluxAndi Shyti
authored andcommitted
drm/i915/selftests: use prandom in selftest
This is part of a prandom cleanup, which removes next_pseudo_random32 and replaces it with the standard PRNG. Signed-off-by: Markus Theil <theil.markus@gmail.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250211063332.16542-2-theil.markus@gmail.com
1 parent fc2ef5b commit efa6fbd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/gpu/drm/i915/selftests/i915_gem.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,15 @@ static void trash_stolen(struct drm_i915_private *i915)
4545
struct i915_ggtt *ggtt = to_gt(i915)->ggtt;
4646
const u64 slot = ggtt->error_capture.start;
4747
const resource_size_t size = resource_size(&i915->dsm.stolen);
48+
struct rnd_state prng;
4849
unsigned long page;
49-
u32 prng = 0x12345678;
5050

5151
/* XXX: fsck. needs some more thought... */
5252
if (!i915_ggtt_has_aperture(ggtt))
5353
return;
5454

55+
prandom_seed_state(&prng, 0x12345678);
56+
5557
for (page = 0; page < size; page += PAGE_SIZE) {
5658
const dma_addr_t dma = i915->dsm.stolen.start + page;
5759
u32 __iomem *s;
@@ -64,8 +66,7 @@ static void trash_stolen(struct drm_i915_private *i915)
6466

6567
s = io_mapping_map_atomic_wc(&ggtt->iomap, slot);
6668
for (x = 0; x < PAGE_SIZE / sizeof(u32); x++) {
67-
prng = next_pseudo_random32(prng);
68-
iowrite32(prng, &s[x]);
69+
iowrite32(prandom_u32_state(&prng), &s[x]);
6970
}
7071
io_mapping_unmap_atomic(s);
7172
}

0 commit comments

Comments
 (0)