treewide: use get_random_u32() when possible
[linux-block.git] / net / sched / sch_netem.c
index bab45b3b1fdb5bc7c9584b4251500e47c606e028..fb00ac40ecb7283a0ac85008e91ec499e66a4ce7 100644 (file)
@@ -171,7 +171,7 @@ static inline struct netem_skb_cb *netem_skb_cb(struct sk_buff *skb)
 static void init_crandom(struct crndstate *state, unsigned long rho)
 {
        state->rho = rho;
-       state->last = prandom_u32();
+       state->last = get_random_u32();
 }
 
 /* get_crandom - correlated random number generator
@@ -184,9 +184,9 @@ static u32 get_crandom(struct crndstate *state)
        unsigned long answer;
 
        if (!state || state->rho == 0)  /* no correlation */
-               return prandom_u32();
+               return get_random_u32();
 
-       value = prandom_u32();
+       value = get_random_u32();
        rho = (u64)state->rho + 1;
        answer = (value * ((1ull<<32) - rho) + state->last * rho) >> 32;
        state->last = answer;
@@ -200,7 +200,7 @@ static u32 get_crandom(struct crndstate *state)
 static bool loss_4state(struct netem_sched_data *q)
 {
        struct clgstate *clg = &q->clg;
-       u32 rnd = prandom_u32();
+       u32 rnd = get_random_u32();
 
        /*
         * Makes a comparison between rnd and the transition
@@ -268,15 +268,15 @@ static bool loss_gilb_ell(struct netem_sched_data *q)
 
        switch (clg->state) {
        case GOOD_STATE:
-               if (prandom_u32() < clg->a1)
+               if (get_random_u32() < clg->a1)
                        clg->state = BAD_STATE;
-               if (prandom_u32() < clg->a4)
+               if (get_random_u32() < clg->a4)
                        return true;
                break;
        case BAD_STATE:
-               if (prandom_u32() < clg->a2)
+               if (get_random_u32() < clg->a2)
                        clg->state = GOOD_STATE;
-               if (prandom_u32() > clg->a3)
+               if (get_random_u32() > clg->a3)
                        return true;
        }
 
@@ -632,7 +632,7 @@ static void get_slot_next(struct netem_sched_data *q, u64 now)
 
        if (!q->slot_dist)
                next_delay = q->slot_config.min_delay +
-                               (prandom_u32() *
+                               (get_random_u32() *
                                 (q->slot_config.max_delay -
                                  q->slot_config.min_delay) >> 32);
        else