Commit 3b60a64f authored by Akinobu Mita's avatar Akinobu Mita Committed by Linus Torvalds

scsi: rename random32() to prandom_u32()

Use preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: Robert Love <robert.w.love@intel.com>
Cc: James Smart <james.smart@emulex.com>
Cc: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 10fdc141
...@@ -2161,7 +2161,7 @@ static void fcoe_ctlr_vn_restart(struct fcoe_ctlr *fip) ...@@ -2161,7 +2161,7 @@ static void fcoe_ctlr_vn_restart(struct fcoe_ctlr *fip)
if (fip->probe_tries < FIP_VN_RLIM_COUNT) { if (fip->probe_tries < FIP_VN_RLIM_COUNT) {
fip->probe_tries++; fip->probe_tries++;
wait = random32() % FIP_VN_PROBE_WAIT; wait = prandom_u32() % FIP_VN_PROBE_WAIT;
} else } else
wait = FIP_VN_RLIM_INT; wait = FIP_VN_RLIM_INT;
mod_timer(&fip->timer, jiffies + msecs_to_jiffies(wait)); mod_timer(&fip->timer, jiffies + msecs_to_jiffies(wait));
...@@ -2794,7 +2794,7 @@ static void fcoe_ctlr_vn_timeout(struct fcoe_ctlr *fip) ...@@ -2794,7 +2794,7 @@ static void fcoe_ctlr_vn_timeout(struct fcoe_ctlr *fip)
fcoe_all_vn2vn, 0); fcoe_all_vn2vn, 0);
fip->port_ka_time = jiffies + fip->port_ka_time = jiffies +
msecs_to_jiffies(FIP_VN_BEACON_INT + msecs_to_jiffies(FIP_VN_BEACON_INT +
(random32() % FIP_VN_BEACON_FUZZ)); (prandom_u32() % FIP_VN_BEACON_FUZZ));
} }
if (time_before(fip->port_ka_time, next_time)) if (time_before(fip->port_ka_time, next_time))
next_time = fip->port_ka_time; next_time = fip->port_ka_time;
......
...@@ -1732,7 +1732,7 @@ lpfc_check_pending_fcoe_event(struct lpfc_hba *phba, uint8_t unreg_fcf) ...@@ -1732,7 +1732,7 @@ lpfc_check_pending_fcoe_event(struct lpfc_hba *phba, uint8_t unreg_fcf)
* use through a sequence of @fcf_cnt eligible FCF records with equal * use through a sequence of @fcf_cnt eligible FCF records with equal
* probability. To perform integer manunipulation of random numbers with * probability. To perform integer manunipulation of random numbers with
* size unit32_t, the lower 16 bits of the 32-bit random number returned * size unit32_t, the lower 16 bits of the 32-bit random number returned
* from random32() are taken as the random random number generated. * from prandom_u32() are taken as the random random number generated.
* *
* Returns true when outcome is for the newly read FCF record should be * Returns true when outcome is for the newly read FCF record should be
* chosen; otherwise, return false when outcome is for keeping the previously * chosen; otherwise, return false when outcome is for keeping the previously
...@@ -1744,7 +1744,7 @@ lpfc_sli4_new_fcf_random_select(struct lpfc_hba *phba, uint32_t fcf_cnt) ...@@ -1744,7 +1744,7 @@ lpfc_sli4_new_fcf_random_select(struct lpfc_hba *phba, uint32_t fcf_cnt)
uint32_t rand_num; uint32_t rand_num;
/* Get 16-bit uniform random number */ /* Get 16-bit uniform random number */
rand_num = (0xFFFF & random32()); rand_num = 0xFFFF & prandom_u32();
/* Decision with probability 1/fcf_cnt */ /* Decision with probability 1/fcf_cnt */
if ((fcf_cnt * rand_num) < 0xFFFF) if ((fcf_cnt * rand_num) < 0xFFFF)
...@@ -2380,7 +2380,7 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) ...@@ -2380,7 +2380,7 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
phba->fcf.eligible_fcf_cnt = 1; phba->fcf.eligible_fcf_cnt = 1;
/* Seeding the random number generator for random selection */ /* Seeding the random number generator for random selection */
seed = (uint32_t)(0xFFFFFFFF & jiffies); seed = (uint32_t)(0xFFFFFFFF & jiffies);
srandom32(seed); prandom_seed(seed);
} }
spin_unlock_irq(&phba->hbalock); spin_unlock_irq(&phba->hbalock);
goto read_next_fcf; goto read_next_fcf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment