random: use symbolic constants for crng_init states
authorJason A. Donenfeld <Jason@zx2c4.com>
Sun, 8 May 2022 11:20:30 +0000 (13:20 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 30 May 2022 07:29:16 +0000 (09:29 +0200)
commit23a1b984f4b878faa1be22f5fcbb974f3ddd4018
treeb5b86bc8f979ea151cc38f18acb53902f4363afb
parentf4cb809a90df1daeaab4e65ae2064918575b4e6d
random: use symbolic constants for crng_init states

commit e3d2c5e79a999aa4e7d6f0127e16d3da5a4ff70d upstream.

crng_init represents a state machine, with three states, and various
rules for transitions. For the longest time, we've been managing these
with "0", "1", and "2", and expecting people to figure it out. To make
the code more obvious, replace these with proper enum values
representing the transition, and then redocument what each of these
states mean.

Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/random.c