diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2013-01-03 07:19:13 -0500 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2013-02-04 02:26:28 -0500 |
commit | aca662a3b1c9b178536267da9fb2f0faa798cb7f (patch) | |
tree | e75eea8674411ec01fd03d689d59f0727a487fca /drivers/mtd/tests | |
parent | bd6ce5ef913a7b4dfe5cd5028309346d32a8c404 (diff) |
mtd: rename random32() to prandom_u32()
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd/tests')
-rw-r--r-- | drivers/mtd/tests/mtd_nandecctest.c | 10 | ||||
-rw-r--r-- | drivers/mtd/tests/mtd_stresstest.c | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/drivers/mtd/tests/mtd_nandecctest.c b/drivers/mtd/tests/mtd_nandecctest.c index 1eee264509a8..5015d10591d9 100644 --- a/drivers/mtd/tests/mtd_nandecctest.c +++ b/drivers/mtd/tests/mtd_nandecctest.c | |||
@@ -44,7 +44,7 @@ struct nand_ecc_test { | |||
44 | static void single_bit_error_data(void *error_data, void *correct_data, | 44 | static void single_bit_error_data(void *error_data, void *correct_data, |
45 | size_t size) | 45 | size_t size) |
46 | { | 46 | { |
47 | unsigned int offset = random32() % (size * BITS_PER_BYTE); | 47 | unsigned int offset = prandom_u32() % (size * BITS_PER_BYTE); |
48 | 48 | ||
49 | memcpy(error_data, correct_data, size); | 49 | memcpy(error_data, correct_data, size); |
50 | __change_bit_le(offset, error_data); | 50 | __change_bit_le(offset, error_data); |
@@ -55,9 +55,9 @@ static void double_bit_error_data(void *error_data, void *correct_data, | |||
55 | { | 55 | { |
56 | unsigned int offset[2]; | 56 | unsigned int offset[2]; |
57 | 57 | ||
58 | offset[0] = random32() % (size * BITS_PER_BYTE); | 58 | offset[0] = prandom_u32() % (size * BITS_PER_BYTE); |
59 | do { | 59 | do { |
60 | offset[1] = random32() % (size * BITS_PER_BYTE); | 60 | offset[1] = prandom_u32() % (size * BITS_PER_BYTE); |
61 | } while (offset[0] == offset[1]); | 61 | } while (offset[0] == offset[1]); |
62 | 62 | ||
63 | memcpy(error_data, correct_data, size); | 63 | memcpy(error_data, correct_data, size); |
@@ -68,7 +68,7 @@ static void double_bit_error_data(void *error_data, void *correct_data, | |||
68 | 68 | ||
69 | static unsigned int random_ecc_bit(size_t size) | 69 | static unsigned int random_ecc_bit(size_t size) |
70 | { | 70 | { |
71 | unsigned int offset = random32() % (3 * BITS_PER_BYTE); | 71 | unsigned int offset = prandom_u32() % (3 * BITS_PER_BYTE); |
72 | 72 | ||
73 | if (size == 256) { | 73 | if (size == 256) { |
74 | /* | 74 | /* |
@@ -76,7 +76,7 @@ static unsigned int random_ecc_bit(size_t size) | |||
76 | * and 17th bit) in ECC code for 256 byte data block | 76 | * and 17th bit) in ECC code for 256 byte data block |
77 | */ | 77 | */ |
78 | while (offset == 16 || offset == 17) | 78 | while (offset == 16 || offset == 17) |
79 | offset = random32() % (3 * BITS_PER_BYTE); | 79 | offset = prandom_u32() % (3 * BITS_PER_BYTE); |
80 | } | 80 | } |
81 | 81 | ||
82 | return offset; | 82 | return offset; |
diff --git a/drivers/mtd/tests/mtd_stresstest.c b/drivers/mtd/tests/mtd_stresstest.c index 3729f679ae5d..1d29739db916 100644 --- a/drivers/mtd/tests/mtd_stresstest.c +++ b/drivers/mtd/tests/mtd_stresstest.c | |||
@@ -55,7 +55,7 @@ static int rand_eb(void) | |||
55 | unsigned int eb; | 55 | unsigned int eb; |
56 | 56 | ||
57 | again: | 57 | again: |
58 | eb = random32(); | 58 | eb = prandom_u32(); |
59 | /* Read or write up 2 eraseblocks at a time - hence 'ebcnt - 1' */ | 59 | /* Read or write up 2 eraseblocks at a time - hence 'ebcnt - 1' */ |
60 | eb %= (ebcnt - 1); | 60 | eb %= (ebcnt - 1); |
61 | if (bbt[eb]) | 61 | if (bbt[eb]) |
@@ -67,7 +67,7 @@ static int rand_offs(void) | |||
67 | { | 67 | { |
68 | unsigned int offs; | 68 | unsigned int offs; |
69 | 69 | ||
70 | offs = random32(); | 70 | offs = prandom_u32(); |
71 | offs %= bufsize; | 71 | offs %= bufsize; |
72 | return offs; | 72 | return offs; |
73 | } | 73 | } |
@@ -76,7 +76,7 @@ static int rand_len(int offs) | |||
76 | { | 76 | { |
77 | unsigned int len; | 77 | unsigned int len; |
78 | 78 | ||
79 | len = random32(); | 79 | len = prandom_u32(); |
80 | len %= (bufsize - offs); | 80 | len %= (bufsize - offs); |
81 | return len; | 81 | return len; |
82 | } | 82 | } |
@@ -191,7 +191,7 @@ static int do_write(void) | |||
191 | 191 | ||
192 | static int do_operation(void) | 192 | static int do_operation(void) |
193 | { | 193 | { |
194 | if (random32() & 1) | 194 | if (prandom_u32() & 1) |
195 | return do_read(); | 195 | return do_read(); |
196 | else | 196 | else |
197 | return do_write(); | 197 | return do_write(); |