提交 50bea5c0 编写于 作者: A Andrew Morton 提交者: Linus Torvalds

drivers/infiniband/hw: rename random32() to prandom_u32()

Use preferable function name which implies using a pseudo-random number
generator.
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 e00adf39
...@@ -62,13 +62,13 @@ static int __cxio_init_resource_fifo(struct kfifo *fifo, ...@@ -62,13 +62,13 @@ static int __cxio_init_resource_fifo(struct kfifo *fifo,
kfifo_in(fifo, (unsigned char *) &entry, sizeof(u32)); kfifo_in(fifo, (unsigned char *) &entry, sizeof(u32));
if (random) { if (random) {
j = 0; j = 0;
random_bytes = random32(); random_bytes = prandom_u32();
for (i = 0; i < RANDOM_SIZE; i++) for (i = 0; i < RANDOM_SIZE; i++)
rarray[i] = i + skip_low; rarray[i] = i + skip_low;
for (i = skip_low + RANDOM_SIZE; i < nr - skip_high; i++) { for (i = skip_low + RANDOM_SIZE; i < nr - skip_high; i++) {
if (j >= RANDOM_SIZE) { if (j >= RANDOM_SIZE) {
j = 0; j = 0;
random_bytes = random32(); random_bytes = prandom_u32();
} }
idx = (random_bytes >> (j * 2)) & 0xF; idx = (random_bytes >> (j * 2)) & 0xF;
kfifo_in(fifo, kfifo_in(fifo,
......
...@@ -54,7 +54,7 @@ u32 c4iw_id_alloc(struct c4iw_id_table *alloc) ...@@ -54,7 +54,7 @@ u32 c4iw_id_alloc(struct c4iw_id_table *alloc)
if (obj < alloc->max) { if (obj < alloc->max) {
if (alloc->flags & C4IW_ID_TABLE_F_RANDOM) if (alloc->flags & C4IW_ID_TABLE_F_RANDOM)
alloc->last += random32() % RANDOM_SKIP; alloc->last += prandom_u32() % RANDOM_SKIP;
else else
alloc->last = obj + 1; alloc->last = obj + 1;
if (alloc->last >= alloc->max) if (alloc->last >= alloc->max)
...@@ -88,7 +88,7 @@ int c4iw_id_table_alloc(struct c4iw_id_table *alloc, u32 start, u32 num, ...@@ -88,7 +88,7 @@ int c4iw_id_table_alloc(struct c4iw_id_table *alloc, u32 start, u32 num,
alloc->start = start; alloc->start = start;
alloc->flags = flags; alloc->flags = flags;
if (flags & C4IW_ID_TABLE_F_RANDOM) if (flags & C4IW_ID_TABLE_F_RANDOM)
alloc->last = random32() % RANDOM_SKIP; alloc->last = prandom_u32() % RANDOM_SKIP;
else else
alloc->last = 0; alloc->last = 0;
alloc->max = num; alloc->max = num;
......
...@@ -93,7 +93,7 @@ static void __propagate_pkey_ev(struct mlx4_ib_dev *dev, int port_num, ...@@ -93,7 +93,7 @@ static void __propagate_pkey_ev(struct mlx4_ib_dev *dev, int port_num,
__be64 mlx4_ib_gen_node_guid(void) __be64 mlx4_ib_gen_node_guid(void)
{ {
#define NODE_GUID_HI ((u64) (((u64)IB_OPENIB_OUI) << 40)) #define NODE_GUID_HI ((u64) (((u64)IB_OPENIB_OUI) << 40))
return cpu_to_be64(NODE_GUID_HI | random32()); return cpu_to_be64(NODE_GUID_HI | prandom_u32());
} }
__be64 mlx4_ib_get_new_demux_tid(struct mlx4_ib_demux_ctx *ctx) __be64 mlx4_ib_get_new_demux_tid(struct mlx4_ib_demux_ctx *ctx)
......
...@@ -460,7 +460,7 @@ static int ipoib_cm_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *even ...@@ -460,7 +460,7 @@ static int ipoib_cm_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *even
goto err_qp; goto err_qp;
} }
psn = random32() & 0xffffff; psn = prandom_u32() & 0xffffff;
ret = ipoib_cm_modify_rx_qp(dev, cm_id, p->qp, psn); ret = ipoib_cm_modify_rx_qp(dev, cm_id, p->qp, psn);
if (ret) if (ret)
goto err_modify; goto err_modify;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册