* [PATCH -v3 01/23] raid6test: use prandom_bytes()
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
2013-03-04 12:58 ` [PATCH -v3 02/23] uuid: " Akinobu Mita
` (21 subsequent siblings)
22 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm; +Cc: Akinobu Mita, Dan Williams, Vinod Koul
Use prandom_bytes() to generate random bytes for test data.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Dan Williams <djbw@fb.com>
Cc: Vinod Koul <vinod.koul@intel.com>
---
No change from v2
crypto/async_tx/raid6test.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/crypto/async_tx/raid6test.c b/crypto/async_tx/raid6test.c
index aa2b027..4a92bac 100644
--- a/crypto/async_tx/raid6test.c
+++ b/crypto/async_tx/raid6test.c
@@ -46,15 +46,10 @@ static void callback(void *param)
static void makedata(int disks)
{
- int i, j;
+ int i;
for (i = 0; i < disks; i++) {
- for (j = 0; j < PAGE_SIZE/sizeof(u32); j += sizeof(u32)) {
- u32 *p = page_address(data[i]) + j;
-
- *p = random32();
- }
-
+ prandom_bytes(page_address(data[i]), PAGE_SIZE);
dataptrs[i] = data[i];
}
}
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 02/23] uuid: use prandom_bytes()
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
2013-03-04 12:58 ` [PATCH -v3 01/23] raid6test: use prandom_bytes() Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
2013-03-04 12:58 ` [PATCH -v3 03/23] x86: pageattr-test: remove srandom32 call Akinobu Mita
` (20 subsequent siblings)
22 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm; +Cc: Akinobu Mita, Theodore Ts'o, Huang Ying
Use prandom_bytes() to generate 16 bytes of pseudo-random bytes.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Huang Ying <ying.huang@intel.com>
---
No change from v2
lib/uuid.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/lib/uuid.c b/lib/uuid.c
index 52a6fe6..398821e 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -25,13 +25,7 @@
static void __uuid_gen_common(__u8 b[16])
{
- int i;
- u32 r;
-
- for (i = 0; i < 4; i++) {
- r = random32();
- memcpy(b + i * 4, &r, 4);
- }
+ prandom_bytes(b, 16);
/* reversion 0b10 */
b[8] = (b[8] & 0x3F) | 0x80;
}
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 03/23] x86: pageattr-test: remove srandom32 call
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
2013-03-04 12:58 ` [PATCH -v3 01/23] raid6test: use prandom_bytes() Akinobu Mita
2013-03-04 12:58 ` [PATCH -v3 02/23] uuid: " Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
2013-03-04 12:58 ` [PATCH -v3 04/23] x86: rename random32() to prandom_u32() Akinobu Mita
` (19 subsequent siblings)
22 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm
Cc: Akinobu Mita, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86
pageattr-test calls srandom32() once every test iteration.
But calling srandom32() after late_initcalls is not meaningfull.
Because the random states for random32() is mixed by good random numbers
in late_initcall prandom_reseed().
So this removes the call to srandom32().
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
* Change from v2
- add Acked-by: line
arch/x86/mm/pageattr-test.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c
index b008656..8b8c381 100644
--- a/arch/x86/mm/pageattr-test.c
+++ b/arch/x86/mm/pageattr-test.c
@@ -130,7 +130,6 @@ static int pageattr_test(void)
}
failed += print_split(&sa);
- srandom32(100);
for (i = 0; i < NTEST; i++) {
unsigned long pfn = random32() % max_pfn_mapped;
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 04/23] x86: rename random32() to prandom_u32()
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
` (2 preceding siblings ...)
2013-03-04 12:58 ` [PATCH -v3 03/23] x86: pageattr-test: remove srandom32 call Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
2013-03-04 12:58 ` [PATCH -v3 05/23] lib/: " Akinobu Mita
` (18 subsequent siblings)
22 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm
Cc: Akinobu Mita, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
* Changes from v2
- add Acked-by: line
arch/x86/mm/pageattr-test.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c
index 8b8c381..9346108 100644
--- a/arch/x86/mm/pageattr-test.c
+++ b/arch/x86/mm/pageattr-test.c
@@ -132,10 +132,10 @@ static int pageattr_test(void)
failed += print_split(&sa);
for (i = 0; i < NTEST; i++) {
- unsigned long pfn = random32() % max_pfn_mapped;
+ unsigned long pfn = prandom_u32() % max_pfn_mapped;
addr[i] = (unsigned long)__va(pfn << PAGE_SHIFT);
- len[i] = random32() % 100;
+ len[i] = prandom_u32() % 100;
len[i] = min_t(unsigned long, len[i], max_pfn_mapped - pfn - 1);
if (len[i] == 0)
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 05/23] lib/: rename random32() to prandom_u32()
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
` (3 preceding siblings ...)
2013-03-04 12:58 ` [PATCH -v3 04/23] x86: rename random32() to prandom_u32() Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
2013-03-04 12:58 ` Akinobu Mita
` (17 subsequent siblings)
22 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm; +Cc: Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
No change from v2
lib/fault-inject.c | 2 +-
lib/list_sort.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/fault-inject.c b/lib/fault-inject.c
index f7210ad..c5c7a76 100644
--- a/lib/fault-inject.c
+++ b/lib/fault-inject.c
@@ -122,7 +122,7 @@ bool should_fail(struct fault_attr *attr, ssize_t size)
return false;
}
- if (attr->probability <= random32() % 100)
+ if (attr->probability <= prandom_u32() % 100)
return false;
if (!fail_stacktrace(attr))
diff --git a/lib/list_sort.c b/lib/list_sort.c
index d7325c6..1183fa7 100644
--- a/lib/list_sort.c
+++ b/lib/list_sort.c
@@ -229,7 +229,7 @@ static int __init list_sort_test(void)
goto exit;
}
/* force some equivalencies */
- el->value = random32() % (TEST_LIST_LEN/3);
+ el->value = prandom_u32() % (TEST_LIST_LEN / 3);
el->serial = i;
el->poison1 = TEST_POISON1;
el->poison2 = TEST_POISON2;
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 06/23] mm/: rename random32() to prandom_u32()
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
2013-03-04 12:58 ` [PATCH -v3 02/23] uuid: " Akinobu Mita
` (21 subsequent siblings)
22 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm; +Cc: Akinobu Mita, linux-mm
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: linux-mm@kvack.org
---
No change from v2
mm/swapfile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/swapfile.c b/mm/swapfile.c
index a1f7772..d417efd 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -2120,7 +2120,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
if (p->bdev) {
if (blk_queue_nonrot(bdev_get_queue(p->bdev))) {
p->flags |= SWP_SOLIDSTATE;
- p->cluster_next = 1 + (random32() % p->highest_bit);
+ p->cluster_next = 1 + (prandom_u32() % p->highest_bit);
}
if ((swap_flags & SWAP_FLAG_DISCARD) && discard_swap(p) == 0)
p->flags |= SWP_DISCARDABLE;
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 06/23] mm/: rename random32() to prandom_u32()
@ 2013-03-04 12:58 ` Akinobu Mita
0 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm; +Cc: Akinobu Mita, linux-mm
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: linux-mm@kvack.org
---
No change from v2
mm/swapfile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/swapfile.c b/mm/swapfile.c
index a1f7772..d417efd 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -2120,7 +2120,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
if (p->bdev) {
if (blk_queue_nonrot(bdev_get_queue(p->bdev))) {
p->flags |= SWP_SOLIDSTATE;
- p->cluster_next = 1 + (random32() % p->highest_bit);
+ p->cluster_next = 1 + (prandom_u32() % p->highest_bit);
}
if ((swap_flags & SWAP_FLAG_DISCARD) && discard_swap(p) == 0)
p->flags |= SWP_DISCARDABLE;
--
1.8.1.2
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 07/23] kernel/: rename random32() to prandom_u32()
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
` (5 preceding siblings ...)
2013-03-04 12:58 ` Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
2013-03-04 12:58 ` [PATCH -v3 08/23] drbd: " Akinobu Mita
` (15 subsequent siblings)
22 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm; +Cc: Akinobu Mita
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
No change from v2
kernel/rcutree.c | 2 +-
kernel/test_kprobes.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 5b8ad82..2f8530b 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1319,7 +1319,7 @@ static int rcu_gp_init(struct rcu_state *rsp)
rnp->grphi, rnp->qsmask);
raw_spin_unlock_irq(&rnp->lock);
#ifdef CONFIG_PROVE_RCU_DELAY
- if ((random32() % (rcu_num_nodes * 8)) == 0)
+ if ((prandom_u32() % (rcu_num_nodes * 8)) == 0)
schedule_timeout_uninterruptible(2);
#endif /* #ifdef CONFIG_PROVE_RCU_DELAY */
cond_resched();
diff --git a/kernel/test_kprobes.c b/kernel/test_kprobes.c
index f8b11a2..12d6ebb 100644
--- a/kernel/test_kprobes.c
+++ b/kernel/test_kprobes.c
@@ -365,7 +365,7 @@ int init_test_probes(void)
target2 = kprobe_target2;
do {
- rand1 = random32();
+ rand1 = prandom_u32();
} while (rand1 <= div_factor);
printk(KERN_INFO "Kprobe smoke test started\n");
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 08/23] drbd: rename random32() to prandom_u32()
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
` (6 preceding siblings ...)
2013-03-04 12:58 ` [PATCH -v3 07/23] kernel/: " Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
2013-03-04 12:58 ` [PATCH -v3 09/23] infiniband: " Akinobu Mita
` (14 subsequent siblings)
22 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm; +Cc: Akinobu Mita, drbd-dev, Jens Axboe
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: drbd-dev@lists.linbit.com
Cc: Jens Axboe <axboe@kernel.dk>
---
No change from v2
drivers/block/drbd/drbd_receiver.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index a9eccfc..83c5ae0 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -757,7 +757,8 @@ static struct socket *drbd_wait_for_connect(struct drbd_tconn *tconn, struct acc
rcu_read_unlock();
timeo = connect_int * HZ;
- timeo += (random32() & 1) ? timeo / 7 : -timeo / 7; /* 28.5% random jitter */
+ /* 28.5% random jitter */
+ timeo += (prandom_u32() & 1) ? timeo / 7 : -timeo / 7;
err = wait_for_completion_interruptible_timeout(&ad->door_bell, timeo);
if (err <= 0)
@@ -953,7 +954,7 @@ retry:
conn_warn(tconn, "Error receiving initial packet\n");
sock_release(s);
randomize:
- if (random32() & 1)
+ if (prandom_u32() & 1)
goto retry;
}
}
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 09/23] infiniband: rename random32() to prandom_u32()
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
` (7 preceding siblings ...)
2013-03-04 12:58 ` [PATCH -v3 08/23] drbd: " Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
[not found] ` <1362401911-14074-10-git-send-email-akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-03-04 12:58 ` [PATCH -v3 10/23] mmc: " Akinobu Mita
` (13 subsequent siblings)
22 siblings, 1 reply; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm
Cc: Akinobu Mita, Roland Dreier, Sean Hefty, Hal Rosenstock,
Steve Wise, linux-rdma
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Cc: Roland Dreier <roland@kernel.org>
Cc: Sean Hefty <sean.hefty@intel.com>
Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
Cc: Steve Wise <swise@chelsio.com>
Cc: linux-rdma@vger.kernel.org
---
* Change from v2
- add Reviewed-by: line
drivers/infiniband/hw/cxgb3/cxio_resource.c | 4 ++--
drivers/infiniband/hw/cxgb4/id_table.c | 4 ++--
drivers/infiniband/hw/mlx4/mad.c | 2 +-
drivers/infiniband/ulp/ipoib/ipoib_cm.c | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/infiniband/hw/cxgb3/cxio_resource.c b/drivers/infiniband/hw/cxgb3/cxio_resource.c
index 31f9201..c40088e 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_resource.c
+++ b/drivers/infiniband/hw/cxgb3/cxio_resource.c
@@ -62,13 +62,13 @@ static int __cxio_init_resource_fifo(struct kfifo *fifo,
kfifo_in(fifo, (unsigned char *) &entry, sizeof(u32));
if (random) {
j = 0;
- random_bytes = random32();
+ random_bytes = prandom_u32();
for (i = 0; i < RANDOM_SIZE; i++)
rarray[i] = i + skip_low;
for (i = skip_low + RANDOM_SIZE; i < nr - skip_high; i++) {
if (j >= RANDOM_SIZE) {
j = 0;
- random_bytes = random32();
+ random_bytes = prandom_u32();
}
idx = (random_bytes >> (j * 2)) & 0xF;
kfifo_in(fifo,
diff --git a/drivers/infiniband/hw/cxgb4/id_table.c b/drivers/infiniband/hw/cxgb4/id_table.c
index f95e5df..0161ae6 100644
--- a/drivers/infiniband/hw/cxgb4/id_table.c
+++ b/drivers/infiniband/hw/cxgb4/id_table.c
@@ -54,7 +54,7 @@ u32 c4iw_id_alloc(struct c4iw_id_table *alloc)
if (obj < alloc->max) {
if (alloc->flags & C4IW_ID_TABLE_F_RANDOM)
- alloc->last += random32() % RANDOM_SKIP;
+ alloc->last += prandom_u32() % RANDOM_SKIP;
else
alloc->last = obj + 1;
if (alloc->last >= alloc->max)
@@ -88,7 +88,7 @@ int c4iw_id_table_alloc(struct c4iw_id_table *alloc, u32 start, u32 num,
alloc->start = start;
alloc->flags = flags;
if (flags & C4IW_ID_TABLE_F_RANDOM)
- alloc->last = random32() % RANDOM_SKIP;
+ alloc->last = prandom_u32() % RANDOM_SKIP;
else
alloc->last = 0;
alloc->max = num;
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
index 934792c..4d599ce 100644
--- a/drivers/infiniband/hw/mlx4/mad.c
+++ b/drivers/infiniband/hw/mlx4/mad.c
@@ -93,7 +93,7 @@ static void __propagate_pkey_ev(struct mlx4_ib_dev *dev, int port_num,
__be64 mlx4_ib_gen_node_guid(void)
{
#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)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 67b0c1d..249976c 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -460,7 +460,7 @@ static int ipoib_cm_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *even
goto err_qp;
}
- psn = random32() & 0xffffff;
+ psn = prandom_u32() & 0xffffff;
ret = ipoib_cm_modify_rx_qp(dev, cm_id, p->qp, psn);
if (ret)
goto err_modify;
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 10/23] mmc: rename random32() to prandom_u32()
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
` (8 preceding siblings ...)
2013-03-04 12:58 ` [PATCH -v3 09/23] infiniband: " Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
2013-03-04 12:58 ` Akinobu Mita
` (12 subsequent siblings)
22 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm; +Cc: Akinobu Mita, Chris Ball, linux-mmc
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Chris Ball <cjb@laptop.org>
Cc: linux-mmc@vger.kernel.org
---
No change from v2
drivers/mmc/core/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 08a3cf2..9290bb5 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -120,8 +120,8 @@ static void mmc_should_fail_request(struct mmc_host *host,
!should_fail(&host->fail_mmc_request, data->blksz * data->blocks))
return;
- data->error = data_errors[random32() % ARRAY_SIZE(data_errors)];
- data->bytes_xfered = (random32() % (data->bytes_xfered >> 9)) << 9;
+ data->error = data_errors[prandom_u32() % ARRAY_SIZE(data_errors)];
+ data->bytes_xfered = (prandom_u32() % (data->bytes_xfered >> 9)) << 9;
}
#else /* CONFIG_FAIL_MMC_REQUEST */
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 11/23] video/uvesafb: rename random32() to prandom_u32()
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
2013-03-04 12:58 ` [PATCH -v3 02/23] uuid: " Akinobu Mita
` (21 subsequent siblings)
22 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm
Cc: Akinobu Mita, Michal Januszewski, Florian Tobias Schandinat, linux-fbdev
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Michal Januszewski <spock@gentoo.org>
Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: linux-fbdev@vger.kernel.org
---
No change from v2
drivers/video/uvesafb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index b75db01..0d0a43c 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -166,7 +166,7 @@ static int uvesafb_exec(struct uvesafb_ktask *task)
memcpy(&m->id, &uvesafb_cn_id, sizeof(m->id));
m->seq = seq;
m->len = len;
- m->ack = random32();
+ m->ack = prandom_u32();
/* uvesafb_task structure */
memcpy(m + 1, &task->t, sizeof(task->t));
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 11/23] video/uvesafb: rename random32() to prandom_u32()
@ 2013-03-04 12:58 ` Akinobu Mita
0 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm
Cc: Akinobu Mita, Michal Januszewski, Florian Tobias Schandinat, linux-fbdev
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Michal Januszewski <spock@gentoo.org>
Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: linux-fbdev@vger.kernel.org
---
No change from v2
drivers/video/uvesafb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index b75db01..0d0a43c 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -166,7 +166,7 @@ static int uvesafb_exec(struct uvesafb_ktask *task)
memcpy(&m->id, &uvesafb_cn_id, sizeof(m->id));
m->seq = seq;
m->len = len;
- m->ack = random32();
+ m->ack = prandom_u32();
/* uvesafb_task structure */
memcpy(m + 1, &task->t, sizeof(task->t));
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 12/23] xfs: rename random32() to prandom_u32()
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
2013-03-04 12:58 ` [PATCH -v3 02/23] uuid: " Akinobu Mita
` (21 subsequent siblings)
22 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm; +Cc: Akinobu Mita, Ben Myers, Alex Elder, xfs
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: <bpm@sgi.com>
Cc: Ben Myers <bpm@sgi.com>
Cc: Alex Elder <elder@kernel.org>
Cc: xfs@oss.sgi.com
---
* Change from v2
- add Acked-by: line
fs/xfs/xfs_alloc.c | 2 +-
fs/xfs/xfs_error.c | 2 +-
fs/xfs/xfs_ialloc.c | 2 +-
fs/xfs/xfs_log.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c
index 0ad2325..a8beb5c 100644
--- a/fs/xfs/xfs_alloc.c
+++ b/fs/xfs/xfs_alloc.c
@@ -842,7 +842,7 @@ xfs_alloc_ag_vextent_near(
*/
int dofirst; /* set to do first algorithm */
- dofirst = random32() & 1;
+ dofirst = prandom_u32() & 1;
#endif
restart:
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index 6104560..07bf3b9 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -66,7 +66,7 @@ xfs_error_test(int error_tag, int *fsidp, char *expression,
int i;
int64_t fsid;
- if (random32() % randfactor)
+ if (prandom_u32() % randfactor)
return 0;
memcpy(&fsid, fsidp, sizeof(xfs_fsid_t));
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index 515bf71..ba62661 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -369,7 +369,7 @@ xfs_ialloc_ag_alloc(
* number from being easily guessable.
*/
error = xfs_ialloc_inode_init(args.mp, tp, agno, args.agbno,
- args.len, random32());
+ args.len, prandom_u32());
if (error)
return error;
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index eec226f..b345a7c 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -3485,7 +3485,7 @@ xlog_ticket_alloc(
tic->t_curr_res = unit_bytes;
tic->t_cnt = cnt;
tic->t_ocnt = cnt;
- tic->t_tid = random32();
+ tic->t_tid = prandom_u32();
tic->t_clientid = client;
tic->t_flags = XLOG_TIC_INITED;
tic->t_trans_type = 0;
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 12/23] xfs: rename random32() to prandom_u32()
@ 2013-03-04 12:58 ` Akinobu Mita
0 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm; +Cc: Ben Myers, Alex Elder, Akinobu Mita, xfs
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: <bpm@sgi.com>
Cc: Ben Myers <bpm@sgi.com>
Cc: Alex Elder <elder@kernel.org>
Cc: xfs@oss.sgi.com
---
* Change from v2
- add Acked-by: line
fs/xfs/xfs_alloc.c | 2 +-
fs/xfs/xfs_error.c | 2 +-
fs/xfs/xfs_ialloc.c | 2 +-
fs/xfs/xfs_log.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c
index 0ad2325..a8beb5c 100644
--- a/fs/xfs/xfs_alloc.c
+++ b/fs/xfs/xfs_alloc.c
@@ -842,7 +842,7 @@ xfs_alloc_ag_vextent_near(
*/
int dofirst; /* set to do first algorithm */
- dofirst = random32() & 1;
+ dofirst = prandom_u32() & 1;
#endif
restart:
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index 6104560..07bf3b9 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -66,7 +66,7 @@ xfs_error_test(int error_tag, int *fsidp, char *expression,
int i;
int64_t fsid;
- if (random32() % randfactor)
+ if (prandom_u32() % randfactor)
return 0;
memcpy(&fsid, fsidp, sizeof(xfs_fsid_t));
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index 515bf71..ba62661 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -369,7 +369,7 @@ xfs_ialloc_ag_alloc(
* number from being easily guessable.
*/
error = xfs_ialloc_inode_init(args.mp, tp, agno, args.agbno,
- args.len, random32());
+ args.len, prandom_u32());
if (error)
return error;
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index eec226f..b345a7c 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -3485,7 +3485,7 @@ xlog_ticket_alloc(
tic->t_curr_res = unit_bytes;
tic->t_cnt = cnt;
tic->t_ocnt = cnt;
- tic->t_tid = random32();
+ tic->t_tid = prandom_u32();
tic->t_clientid = client;
tic->t_flags = XLOG_TIC_INITED;
tic->t_trans_type = 0;
--
1.8.1.2
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 35+ messages in thread
* Re: [PATCH -v3 12/23] xfs: rename random32() to prandom_u32()
2013-03-04 12:58 ` Akinobu Mita
@ 2013-03-07 18:48 ` Ben Myers
-1 siblings, 0 replies; 35+ messages in thread
From: Ben Myers @ 2013-03-07 18:48 UTC (permalink / raw)
To: Akinobu Mita; +Cc: linux-kernel, akpm, Alex Elder, xfs
Akinobu,
On Mon, Mar 04, 2013 at 09:58:20PM +0900, Akinobu Mita wrote:
> Use more preferable function name which implies using a pseudo-random
> number generator.
>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> Acked-by: <bpm@sgi.com>
> Cc: Ben Myers <bpm@sgi.com>
> Cc: Alex Elder <elder@kernel.org>
> Cc: xfs@oss.sgi.com
Applied this to git://oss.sgi.com/xfs/xfs.git, master branch.
Thanks!
-Ben
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH -v3 12/23] xfs: rename random32() to prandom_u32()
@ 2013-03-07 18:48 ` Ben Myers
0 siblings, 0 replies; 35+ messages in thread
From: Ben Myers @ 2013-03-07 18:48 UTC (permalink / raw)
To: Akinobu Mita; +Cc: akpm, Alex Elder, linux-kernel, xfs
Akinobu,
On Mon, Mar 04, 2013 at 09:58:20PM +0900, Akinobu Mita wrote:
> Use more preferable function name which implies using a pseudo-random
> number generator.
>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> Acked-by: <bpm@sgi.com>
> Cc: Ben Myers <bpm@sgi.com>
> Cc: Alex Elder <elder@kernel.org>
> Cc: xfs@oss.sgi.com
Applied this to git://oss.sgi.com/xfs/xfs.git, master branch.
Thanks!
-Ben
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH -v3 13/23] uwb: rename random32() to prandom_u32()
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
` (11 preceding siblings ...)
2013-03-04 12:58 ` Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
2013-03-04 12:58 ` [PATCH -v3 14/23] lguest: " Akinobu Mita
` (9 subsequent siblings)
22 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm; +Cc: Akinobu Mita, linux-usb
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: linux-usb@vger.kernel.org
---
No change from v2
drivers/uwb/rsv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/uwb/rsv.c b/drivers/uwb/rsv.c
index 0b0d8bc..f4ae05f 100644
--- a/drivers/uwb/rsv.c
+++ b/drivers/uwb/rsv.c
@@ -231,7 +231,7 @@ void uwb_rsv_backoff_win_increment(struct uwb_rc *rc)
return;
bow->window <<= 1;
- bow->n = random32() & (bow->window - 1);
+ bow->n = prandom_u32() & (bow->window - 1);
dev_dbg(dev, "new_window=%d, n=%d\n: ", bow->window, bow->n);
/* reset the timer associated variables */
@@ -557,7 +557,7 @@ int uwb_rsv_establish(struct uwb_rsv *rsv)
if (ret)
goto out;
- rsv->tiebreaker = random32() & 1;
+ rsv->tiebreaker = prandom_u32() & 1;
/* get available mas bitmap */
uwb_drp_available(rc, &available);
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 14/23] lguest: rename random32() to prandom_u32()
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
` (12 preceding siblings ...)
2013-03-04 12:58 ` [PATCH -v3 13/23] uwb: " Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
2013-03-04 12:58 ` [PATCH -v3 15/23] scsi: " Akinobu Mita
` (8 subsequent siblings)
22 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm; +Cc: Akinobu Mita, Rusty Russell, lguest
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: lguest@lists.ozlabs.org
---
No change from v2
drivers/lguest/page_tables.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c
index 3b62be16..864baab 100644
--- a/drivers/lguest/page_tables.c
+++ b/drivers/lguest/page_tables.c
@@ -686,7 +686,7 @@ static unsigned int new_pgdir(struct lg_cpu *cpu,
* We pick one entry at random to throw out. Choosing the Least
* Recently Used might be better, but this is easy.
*/
- next = random32() % ARRAY_SIZE(cpu->lg->pgdirs);
+ next = prandom_u32() % ARRAY_SIZE(cpu->lg->pgdirs);
/* If it's never been allocated at all before, try now. */
if (!cpu->lg->pgdirs[next].pgdir) {
cpu->lg->pgdirs[next].pgdir =
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 15/23] scsi: rename random32() to prandom_u32()
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
` (13 preceding siblings ...)
2013-03-04 12:58 ` [PATCH -v3 14/23] lguest: " Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
2013-03-04 12:58 ` [PATCH -v3 16/23] drivers/net: " Akinobu Mita
` (7 subsequent siblings)
22 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm
Cc: Akinobu Mita, James E.J. Bottomley, Robert Love, devel,
James Smart, Andrew Vasquez, linux-driver, linux-scsi
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: Robert Love <robert.w.love@intel.com>
Cc: devel@open-fcoe.org
Cc: James Smart <james.smart@emulex.com>
Cc: Andrew Vasquez <andrew.vasquez@qlogic.com>
Cc: linux-driver@qlogic.com
Cc: linux-scsi@vger.kernel.org
---
No change from v2
drivers/scsi/fcoe/fcoe_ctlr.c | 4 ++--
drivers/scsi/lpfc/lpfc_hbadisc.c | 6 +++---
drivers/scsi/qla2xxx/qla_attr.c | 7 +++++--
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c
index 08c3bc3..43bb558 100644
--- a/drivers/scsi/fcoe/fcoe_ctlr.c
+++ b/drivers/scsi/fcoe/fcoe_ctlr.c
@@ -2161,7 +2161,7 @@ static void fcoe_ctlr_vn_restart(struct fcoe_ctlr *fip)
if (fip->probe_tries < FIP_VN_RLIM_COUNT) {
fip->probe_tries++;
- wait = random32() % FIP_VN_PROBE_WAIT;
+ wait = prandom_u32() % FIP_VN_PROBE_WAIT;
} else
wait = FIP_VN_RLIM_INT;
mod_timer(&fip->timer, jiffies + msecs_to_jiffies(wait));
@@ -2794,7 +2794,7 @@ static void fcoe_ctlr_vn_timeout(struct fcoe_ctlr *fip)
fcoe_all_vn2vn, 0);
fip->port_ka_time = jiffies +
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))
next_time = fip->port_ka_time;
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index d7096ad..bfda184 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -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
* probability. To perform integer manunipulation of random numbers with
* 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
* 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)
uint32_t rand_num;
/* Get 16-bit uniform random number */
- rand_num = (0xFFFF & random32());
+ rand_num = 0xFFFF & prandom_u32();
/* Decision with probability 1/fcf_cnt */
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)
phba->fcf.eligible_fcf_cnt = 1;
/* Seeding the random number generator for random selection */
seed = (uint32_t)(0xFFFFFFFF & jiffies);
- srandom32(seed);
+ prandom_seed(seed);
}
spin_unlock_irq(&phba->hbalock);
goto read_next_fcf;
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 1d82eef..04bf7b8 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1940,8 +1940,11 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
/* No pending activities shall be there on the vha now */
if (ql2xextended_error_logging & ql_dbg_user)
- msleep(random32()%10); /* Just to see if something falls on
- * the net we have placed below */
+ msleep(prandom_u32() % 10);
+ /*
+ * Just to see if something falls on the net we have placed
+ * below
+ */
BUG_ON(atomic_read(&vha->vref_count));
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 16/23] drivers/net: rename random32() to prandom_u32()
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
` (14 preceding siblings ...)
2013-03-04 12:58 ` [PATCH -v3 15/23] scsi: " Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
2013-03-04 13:37 ` Arend van Spriel
2013-03-04 12:58 ` [PATCH -v3 17/23] net/sunrpc: " Akinobu Mita
` (6 subsequent siblings)
22 siblings, 1 reply; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm
Cc: Akinobu Mita, David S. Miller, Michael Chan, Thomas Sailer,
Jean-Paul Roubelat, Bing Zhao, Brett Rudley, Arend van Spriel,
Franky (Zhenhui) Lin, Hante Meuleman, brcm80211-dev-list, netdev,
linux-hams, linux-wireless
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Thomas Sailer <t.sailer@alumni.ethz.ch>
Acked-by: Bing Zhao <bzhao@marvell.com> [mwifiex]
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Michael Chan <mchan@broadcom.com>
Cc: Thomas Sailer <t.sailer@alumni.ethz.ch>
Cc: Jean-Paul Roubelat <jpr@f6fbb.org>
Cc: Bing Zhao <bzhao@marvell.com>
Cc: Brett Rudley <brudley@broadcom.com>
Cc: Arend van Spriel <arend@broadcom.com>
Cc: "Franky (Zhenhui) Lin" <frankyl@broadcom.com>
Cc: Hante Meuleman <meuleman@broadcom.com>
Cc: brcm80211-dev-list@broadcom.com
Cc: netdev@vger.kernel.org
Cc: linux-hams@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
---
* Changes from v2
- add Acked-by: line
- add rename for brcm80211
drivers/net/ethernet/broadcom/cnic.c | 4 ++--
drivers/net/hamradio/baycom_epp.c | 2 +-
drivers/net/hamradio/hdlcdrv.c | 2 +-
drivers/net/hamradio/yam.c | 2 +-
drivers/net/wireless/brcm80211/brcmfmac/p2p.c | 2 +-
drivers/net/wireless/mwifiex/cfg80211.c | 4 ++--
6 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c
index 149a3a0..5abdd48 100644
--- a/drivers/net/ethernet/broadcom/cnic.c
+++ b/drivers/net/ethernet/broadcom/cnic.c
@@ -4085,7 +4085,7 @@ static int cnic_cm_alloc_mem(struct cnic_dev *dev)
if (!cp->csk_tbl)
return -ENOMEM;
- port_id = random32();
+ port_id = prandom_u32();
port_id %= CNIC_LOCAL_PORT_RANGE;
if (cnic_init_id_tbl(&cp->csk_port_tbl, CNIC_LOCAL_PORT_RANGE,
CNIC_LOCAL_PORT_MIN, port_id)) {
@@ -4145,7 +4145,7 @@ static int cnic_cm_init_bnx2_hw(struct cnic_dev *dev)
{
u32 seed;
- seed = random32();
+ seed = prandom_u32();
cnic_ctx_wr(dev, 45, 0, seed);
return 0;
}
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
index 49b8b58..484f77e 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -449,7 +449,7 @@ static int transmit(struct baycom_state *bc, int cnt, unsigned char stat)
if ((--bc->hdlctx.slotcnt) > 0)
return 0;
bc->hdlctx.slotcnt = bc->ch_params.slottime;
- if ((random32() % 256) > bc->ch_params.ppersist)
+ if ((prandom_u32() % 256) > bc->ch_params.ppersist)
return 0;
}
}
diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c
index a4a3516..3169252 100644
--- a/drivers/net/hamradio/hdlcdrv.c
+++ b/drivers/net/hamradio/hdlcdrv.c
@@ -389,7 +389,7 @@ void hdlcdrv_arbitrate(struct net_device *dev, struct hdlcdrv_state *s)
if ((--s->hdlctx.slotcnt) > 0)
return;
s->hdlctx.slotcnt = s->ch_params.slottime;
- if ((random32() % 256) > s->ch_params.ppersist)
+ if ((prandom_u32() % 256) > s->ch_params.ppersist)
return;
start_tx(dev, s);
}
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index 4cf8f10..ae3feb0 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -638,7 +638,7 @@ static void yam_arbitrate(struct net_device *dev)
yp->slotcnt = yp->slot / 10;
/* is random > persist ? */
- if ((random32() % 256) > yp->pers)
+ if ((prandom_u32() % 256) > yp->pers)
return;
yam_start_tx(dev, yp);
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
index 4166e64..bca31a8 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
@@ -1118,7 +1118,7 @@ static void brcmf_p2p_afx_handler(struct work_struct *work)
if (afx_hdl->is_listen && afx_hdl->my_listen_chan)
/* 100ms ~ 300ms */
err = brcmf_p2p_discover_listen(p2p, afx_hdl->my_listen_chan,
- 100 * (1 + (random32() % 3)));
+ 100 * (1 + (prandom_u32() % 3)));
else
err = brcmf_p2p_act_frm_search(p2p, afx_hdl->peer_listen_chan);
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index a44023a..4513707 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -216,7 +216,7 @@ mwifiex_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
mwifiex_form_mgmt_frame(skb, buf, len);
mwifiex_queue_tx_pkt(priv, skb);
- *cookie = random32() | 1;
+ *cookie = prandom_u32() | 1;
cfg80211_mgmt_tx_status(wdev, *cookie, buf, len, true, GFP_ATOMIC);
wiphy_dbg(wiphy, "info: management frame transmitted\n");
@@ -271,7 +271,7 @@ mwifiex_cfg80211_remain_on_channel(struct wiphy *wiphy,
duration);
if (!ret) {
- *cookie = random32() | 1;
+ *cookie = prandom_u32() | 1;
priv->roc_cfg.cookie = *cookie;
priv->roc_cfg.chan = *chan;
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* Re: [PATCH -v3 16/23] drivers/net: rename random32() to prandom_u32()
@ 2013-03-04 13:37 ` Arend van Spriel
0 siblings, 0 replies; 35+ messages in thread
From: Arend van Spriel @ 2013-03-04 13:37 UTC (permalink / raw)
To: Akinobu Mita
Cc: linux-kernel, akpm, David S. Miller, Michael Chan, Thomas Sailer,
Jean-Paul Roubelat, Bing Zhao, Brett Rudley,
Franky (Zhenhui) Lin, Hante Meuleman, brcm80211-dev-list, netdev,
linux-hams, linux-wireless
On 03/04/13 13:58, Akinobu Mita wrote:
> Use more preferable function name which implies using a pseudo-random
> number generator.
>
> Signed-off-by: Akinobu Mita<akinobu.mita@gmail.com>
> Acked-by: Thomas Sailer<t.sailer@alumni.ethz.ch>
> Acked-by: Bing Zhao<bzhao@marvell.com> [mwifiex]
> Cc: "David S. Miller"<davem@davemloft.net>
> Cc: Michael Chan<mchan@broadcom.com>
> Cc: Thomas Sailer<t.sailer@alumni.ethz.ch>
> Cc: Jean-Paul Roubelat<jpr@f6fbb.org>
> Cc: Bing Zhao<bzhao@marvell.com>
> Cc: Brett Rudley<brudley@broadcom.com>
> Cc: Arend van Spriel<arend@broadcom.com>
> Cc: "Franky (Zhenhui) Lin"<frankyl@broadcom.com>
> Cc: Hante Meuleman<meuleman@broadcom.com>
> Cc: brcm80211-dev-list@broadcom.com
> Cc: netdev@vger.kernel.org
> Cc: linux-hams@vger.kernel.org
> Cc: linux-wireless@vger.kernel.org
> ---
> * Changes from v2
> - add Acked-by: line
> - add rename for brcm80211
>
> drivers/net/ethernet/broadcom/cnic.c | 4 ++--
> drivers/net/hamradio/baycom_epp.c | 2 +-
> drivers/net/hamradio/hdlcdrv.c | 2 +-
> drivers/net/hamradio/yam.c | 2 +-
> drivers/net/wireless/brcm80211/brcmfmac/p2p.c | 2 +-
> drivers/net/wireless/mwifiex/cfg80211.c | 4 ++--
> 6 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
> index 4166e64..bca31a8 100644
> --- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
> +++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
> @@ -1118,7 +1118,7 @@ static void brcmf_p2p_afx_handler(struct work_struct *work)
> if (afx_hdl->is_listen&& afx_hdl->my_listen_chan)
> /* 100ms ~ 300ms */
> err = brcmf_p2p_discover_listen(p2p, afx_hdl->my_listen_chan,
> - 100 * (1 + (random32() % 3)));
> + 100 * (1 + (prandom_u32() % 3)));
Seems like indentation is wrong now. Please retain the alignment.
Regards,
Arend
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH -v3 16/23] drivers/net: rename random32() to prandom_u32()
@ 2013-03-04 13:37 ` Arend van Spriel
0 siblings, 0 replies; 35+ messages in thread
From: Arend van Spriel @ 2013-03-04 13:37 UTC (permalink / raw)
To: Akinobu Mita
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, David S. Miller,
Michael Chan, Thomas Sailer, Jean-Paul Roubelat, Bing Zhao,
Brett Rudley, Franky (Zhenhui) Lin, Hante Meuleman,
brcm80211-dev-list-dY08KVG/lbpWk0Htik3J/w,
netdev-u79uwXL29TY76Z2rM5mHXA, linux-hams-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA
On 03/04/13 13:58, Akinobu Mita wrote:
> Use more preferable function name which implies using a pseudo-random
> number generator.
>
> Signed-off-by: Akinobu Mita<akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Acked-by: Thomas Sailer<t.sailer-aAjG49QhEdKVRmA6MYkXiA@public.gmane.org>
> Acked-by: Bing Zhao<bzhao-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org> [mwifiex]
> Cc: "David S. Miller"<davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
> Cc: Michael Chan<mchan-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
> Cc: Thomas Sailer<t.sailer-aAjG49QhEdKVRmA6MYkXiA@public.gmane.org>
> Cc: Jean-Paul Roubelat<jpr-3OwtVqItl4LYtjvyW6yDsg@public.gmane.org>
> Cc: Bing Zhao<bzhao-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
> Cc: Brett Rudley<brudley-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
> Cc: Arend van Spriel<arend-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
> Cc: "Franky (Zhenhui) Lin"<frankyl-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
> Cc: Hante Meuleman<meuleman-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
> Cc: brcm80211-dev-list-dY08KVG/lbpWk0Htik3J/w@public.gmane.org
> Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: linux-hams-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> ---
> * Changes from v2
> - add Acked-by: line
> - add rename for brcm80211
>
> drivers/net/ethernet/broadcom/cnic.c | 4 ++--
> drivers/net/hamradio/baycom_epp.c | 2 +-
> drivers/net/hamradio/hdlcdrv.c | 2 +-
> drivers/net/hamradio/yam.c | 2 +-
> drivers/net/wireless/brcm80211/brcmfmac/p2p.c | 2 +-
> drivers/net/wireless/mwifiex/cfg80211.c | 4 ++--
> 6 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
> index 4166e64..bca31a8 100644
> --- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
> +++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
> @@ -1118,7 +1118,7 @@ static void brcmf_p2p_afx_handler(struct work_struct *work)
> if (afx_hdl->is_listen&& afx_hdl->my_listen_chan)
> /* 100ms ~ 300ms */
> err = brcmf_p2p_discover_listen(p2p, afx_hdl->my_listen_chan,
> - 100 * (1 + (random32() % 3)));
> + 100 * (1 + (prandom_u32() % 3)));
Seems like indentation is wrong now. Please retain the alignment.
Regards,
Arend
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH -v3 16/23] drivers/net: rename random32() to prandom_u32()
2013-03-04 13:37 ` Arend van Spriel
(?)
@ 2013-03-04 21:53 ` Akinobu Mita
-1 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 21:53 UTC (permalink / raw)
To: Arend van Spriel
Cc: LKML, Andrew Morton, David S. Miller, Michael Chan,
Thomas Sailer, Jean-Paul Roubelat, Bing Zhao, Brett Rudley,
Franky (Zhenhui) Lin, Hante Meuleman, brcm80211-dev-list, netdev,
linux-hams, linux-wireless
2013/3/4 Arend van Spriel <arend@broadcom.com>
>>
>> @@ -1118,7 +1118,7 @@ static void brcmf_p2p_afx_handler(struct work_struct *work)
>> if (afx_hdl->is_listen&& afx_hdl->my_listen_chan)
>>
>> /* 100ms ~ 300ms */
>> err = brcmf_p2p_discover_listen(p2p, afx_hdl->my_listen_chan,
>> - 100 * (1 + (random32() % 3)));
>> + 100 * (1 + (prandom_u32() % 3)));
>
>
> Seems like indentation is wrong now. Please retain the alignment.
OK, I'll fix it.
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH -v3 17/23] net/sunrpc: rename random32() to prandom_u32()
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
` (15 preceding siblings ...)
2013-03-04 12:58 ` [PATCH -v3 16/23] drivers/net: " Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
2013-03-04 22:44 ` Myklebust, Trond
2013-03-04 12:58 ` [PATCH -v3 18/23] net/sched: " Akinobu Mita
` (5 subsequent siblings)
22 siblings, 1 reply; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm
Cc: Akinobu Mita, J. Bruce Fields, Trond Myklebust, David S. Miller,
netdev, linux-nfs
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Cc: linux-nfs@vger.kernel.org
---
No change from v2
net/sunrpc/auth_gss/gss_krb5_wrap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/sunrpc/auth_gss/gss_krb5_wrap.c b/net/sunrpc/auth_gss/gss_krb5_wrap.c
index 88edec9..1da52d1 100644
--- a/net/sunrpc/auth_gss/gss_krb5_wrap.c
+++ b/net/sunrpc/auth_gss/gss_krb5_wrap.c
@@ -130,8 +130,8 @@ gss_krb5_make_confounder(char *p, u32 conflen)
/* initialize to random value */
if (i == 0) {
- i = random32();
- i = (i << 32) | random32();
+ i = prandom_u32();
+ i = (i << 32) | prandom_u32();
}
switch (conflen) {
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* Re: [PATCH -v3 17/23] net/sunrpc: rename random32() to prandom_u32()
2013-03-04 12:58 ` [PATCH -v3 17/23] net/sunrpc: " Akinobu Mita
@ 2013-03-04 22:44 ` Myklebust, Trond
0 siblings, 0 replies; 35+ messages in thread
From: Myklebust, Trond @ 2013-03-04 22:44 UTC (permalink / raw)
To: Akinobu Mita
Cc: linux-kernel, akpm, J. Bruce Fields, David S. Miller, netdev, linux-nfs
[-- Attachment #1: Type: text/plain, Size: 1118 bytes --]
On Mon, 2013-03-04 at 21:58 +0900, Akinobu Mita wrote:
> Use more preferable function name which implies using a pseudo-random
> number generator.
>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> Cc: "J. Bruce Fields" <bfields@fieldses.org>
> Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: netdev@vger.kernel.org
> Cc: linux-nfs@vger.kernel.org
> ---
>
> No change from v2
>
> net/sunrpc/auth_gss/gss_krb5_wrap.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/sunrpc/auth_gss/gss_krb5_wrap.c b/net/sunrpc/auth_gss/gss_krb5_wrap.c
> index 88edec9..1da52d1 100644
> --- a/net/sunrpc/auth_gss/gss_krb5_wrap.c
> +++ b/net/sunrpc/auth_gss/gss_krb5_wrap.c
> @@ -130,8 +130,8 @@ gss_krb5_make_confounder(char *p, u32 conflen)
>
> /* initialize to random value */
> if (i == 0) {
> - i = random32();
> - i = (i << 32) | random32();
> + i = prandom_u32();
> + i = (i << 32) | prandom_u32();
> }
>
> switch (conflen) {
Acked-by: Trond Myklebust <Trond.Myklebust@netapp.com>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH -v3 18/23] net/sched: rename random32() to prandom_u32()
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
` (16 preceding siblings ...)
2013-03-04 12:58 ` [PATCH -v3 17/23] net/sunrpc: " Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
2013-03-04 12:58 ` [PATCH -v3 19/23] net/netfilter: " Akinobu Mita
` (4 subsequent siblings)
22 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm
Cc: Akinobu Mita, Stephen Hemminger, Jamal Hadi Salim,
David S. Miller, netem, netdev
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Stephen Hemminger <shemminger@vyatta.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netem@lists.linux-foundation.org
Cc: netdev@vger.kernel.org
Cc: netdev@vger.kernel.org
---
No change from v2
net/sched/sch_choke.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c
index cc37dd5..ef53ab8 100644
--- a/net/sched/sch_choke.c
+++ b/net/sched/sch_choke.c
@@ -80,7 +80,7 @@ struct choke_sched_data {
/* deliver a random number between 0 and N - 1 */
static u32 random_N(unsigned int N)
{
- return reciprocal_divide(random32(), N);
+ return reciprocal_divide(prandom_u32(), N);
}
/* number of elements in queue including holes */
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 19/23] net/netfilter: rename random32() to prandom_u32()
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
` (17 preceding siblings ...)
2013-03-04 12:58 ` [PATCH -v3 18/23] net/sched: " Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
2013-03-04 12:58 ` [PATCH -v3 20/23] net/core: " Akinobu Mita
` (3 subsequent siblings)
22 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm
Cc: Akinobu Mita, Pablo Neira Ayuso, Patrick McHardy,
netfilter-devel, netfilter, coreteam, David S. Miller, netdev
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: netfilter-devel@vger.kernel.org
Cc: netfilter@vger.kernel.org
Cc: coreteam@netfilter.org
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
---
No change from v2
net/netfilter/nf_conntrack_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index c8e001a..f84965a 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -264,7 +264,7 @@ static void death_by_event(unsigned long ul_conntrack)
if (nf_conntrack_event(IPCT_DESTROY, ct) < 0) {
/* bad luck, let's retry again */
ecache->timeout.expires = jiffies +
- (random32() % net->ct.sysctl_events_retry_timeout);
+ (prandom_u32() % net->ct.sysctl_events_retry_timeout);
add_timer(&ecache->timeout);
return;
}
@@ -283,7 +283,7 @@ void nf_ct_dying_timeout(struct nf_conn *ct)
/* set a new timer to retry event delivery */
setup_timer(&ecache->timeout, death_by_event, (unsigned long)ct);
ecache->timeout.expires = jiffies +
- (random32() % net->ct.sysctl_events_retry_timeout);
+ (prandom_u32() % net->ct.sysctl_events_retry_timeout);
add_timer(&ecache->timeout);
}
EXPORT_SYMBOL_GPL(nf_ct_dying_timeout);
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 20/23] net/core: rename random32() to prandom_u32()
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
` (18 preceding siblings ...)
2013-03-04 12:58 ` [PATCH -v3 19/23] net/netfilter: " Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
2013-03-04 12:58 ` [PATCH -v3 21/23] net/core: remove duplicate statements by do-while loop Akinobu Mita
` (2 subsequent siblings)
22 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm; +Cc: Akinobu Mita, David S. Miller, netdev
Use more preferable function name which implies using a pseudo-random
number generator.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
---
No change from v2
net/core/pktgen.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 6048fc1..4582275 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2198,7 +2198,7 @@ static inline int f_pick(struct pktgen_dev *pkt_dev)
pkt_dev->curfl = 0; /*reset */
}
} else {
- flow = random32() % pkt_dev->cflows;
+ flow = prandom_u32() % pkt_dev->cflows;
pkt_dev->curfl = flow;
if (pkt_dev->flows[flow].count > pkt_dev->lflow) {
@@ -2246,7 +2246,7 @@ static void set_cur_queue_map(struct pktgen_dev *pkt_dev)
else if (pkt_dev->queue_map_min <= pkt_dev->queue_map_max) {
__u16 t;
if (pkt_dev->flags & F_QUEUE_MAP_RND) {
- t = random32() %
+ t = prandom_u32() %
(pkt_dev->queue_map_max -
pkt_dev->queue_map_min + 1)
+ pkt_dev->queue_map_min;
@@ -2278,7 +2278,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
__u32 tmp;
if (pkt_dev->flags & F_MACSRC_RND)
- mc = random32() % pkt_dev->src_mac_count;
+ mc = prandom_u32() % pkt_dev->src_mac_count;
else {
mc = pkt_dev->cur_src_mac_offset++;
if (pkt_dev->cur_src_mac_offset >=
@@ -2304,7 +2304,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
__u32 tmp;
if (pkt_dev->flags & F_MACDST_RND)
- mc = random32() % pkt_dev->dst_mac_count;
+ mc = prandom_u32() % pkt_dev->dst_mac_count;
else {
mc = pkt_dev->cur_dst_mac_offset++;
@@ -2331,21 +2331,21 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
for (i = 0; i < pkt_dev->nr_labels; i++)
if (pkt_dev->labels[i] & MPLS_STACK_BOTTOM)
pkt_dev->labels[i] = MPLS_STACK_BOTTOM |
- ((__force __be32)random32() &
+ ((__force __be32)prandom_u32() &
htonl(0x000fffff));
}
if ((pkt_dev->flags & F_VID_RND) && (pkt_dev->vlan_id != 0xffff)) {
- pkt_dev->vlan_id = random32() & (4096-1);
+ pkt_dev->vlan_id = prandom_u32() & (4096 - 1);
}
if ((pkt_dev->flags & F_SVID_RND) && (pkt_dev->svlan_id != 0xffff)) {
- pkt_dev->svlan_id = random32() & (4096 - 1);
+ pkt_dev->svlan_id = prandom_u32() & (4096 - 1);
}
if (pkt_dev->udp_src_min < pkt_dev->udp_src_max) {
if (pkt_dev->flags & F_UDPSRC_RND)
- pkt_dev->cur_udp_src = random32() %
+ pkt_dev->cur_udp_src = prandom_u32() %
(pkt_dev->udp_src_max - pkt_dev->udp_src_min)
+ pkt_dev->udp_src_min;
@@ -2358,7 +2358,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
if (pkt_dev->udp_dst_min < pkt_dev->udp_dst_max) {
if (pkt_dev->flags & F_UDPDST_RND) {
- pkt_dev->cur_udp_dst = random32() %
+ pkt_dev->cur_udp_dst = prandom_u32() %
(pkt_dev->udp_dst_max - pkt_dev->udp_dst_min)
+ pkt_dev->udp_dst_min;
} else {
@@ -2375,7 +2375,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
if (imn < imx) {
__u32 t;
if (pkt_dev->flags & F_IPSRC_RND)
- t = random32() % (imx - imn) + imn;
+ t = prandom_u32() % (imx - imn) + imn;
else {
t = ntohl(pkt_dev->cur_saddr);
t++;
@@ -2396,7 +2396,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
__be32 s;
if (pkt_dev->flags & F_IPDST_RND) {
- t = random32() % (imx - imn) + imn;
+ t = prandom_u32() % (imx - imn) + imn;
s = htonl(t);
while (ipv4_is_loopback(s) ||
@@ -2404,7 +2404,8 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
ipv4_is_lbcast(s) ||
ipv4_is_zeronet(s) ||
ipv4_is_local_multicast(s)) {
- t = random32() % (imx - imn) + imn;
+ t = prandom_u32() %
+ (imx - imn) + imn;
s = htonl(t);
}
pkt_dev->cur_daddr = s;
@@ -2437,7 +2438,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
for (i = 0; i < 4; i++) {
pkt_dev->cur_in6_daddr.s6_addr32[i] =
- (((__force __be32)random32() |
+ (((__force __be32)prandom_u32() |
pkt_dev->min_in6_daddr.s6_addr32[i]) &
pkt_dev->max_in6_daddr.s6_addr32[i]);
}
@@ -2447,7 +2448,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
if (pkt_dev->min_pkt_size < pkt_dev->max_pkt_size) {
__u32 t;
if (pkt_dev->flags & F_TXSIZE_RND) {
- t = random32() %
+ t = prandom_u32() %
(pkt_dev->max_pkt_size - pkt_dev->min_pkt_size)
+ pkt_dev->min_pkt_size;
} else {
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 21/23] net/core: remove duplicate statements by do-while loop
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
` (19 preceding siblings ...)
2013-03-04 12:58 ` [PATCH -v3 20/23] net/core: " Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
2013-03-04 12:58 ` [PATCH -v3 22/23] net: rename random32 to prandom Akinobu Mita
2013-03-04 12:58 ` [PATCH -v3 23/23] remove unused random32() and srandom32() Akinobu Mita
22 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm; +Cc: Akinobu Mita, David S. Miller, netdev
Remove duplicate statements by using do-while loop instead of while loop.
- A;
- while (e) {
+ do {
A;
- }
+ } while (e);
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
---
No change from v2
net/core/pktgen.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 4582275..5c21742 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2396,18 +2396,15 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
__be32 s;
if (pkt_dev->flags & F_IPDST_RND) {
- t = prandom_u32() % (imx - imn) + imn;
- s = htonl(t);
-
- while (ipv4_is_loopback(s) ||
- ipv4_is_multicast(s) ||
- ipv4_is_lbcast(s) ||
- ipv4_is_zeronet(s) ||
- ipv4_is_local_multicast(s)) {
+ do {
t = prandom_u32() %
(imx - imn) + imn;
s = htonl(t);
- }
+ } while (ipv4_is_loopback(s) ||
+ ipv4_is_multicast(s) ||
+ ipv4_is_lbcast(s) ||
+ ipv4_is_zeronet(s) ||
+ ipv4_is_local_multicast(s));
pkt_dev->cur_daddr = s;
} else {
t = ntohl(pkt_dev->cur_daddr);
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 22/23] net: rename random32 to prandom
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
` (20 preceding siblings ...)
2013-03-04 12:58 ` [PATCH -v3 21/23] net/core: remove duplicate statements by do-while loop Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
2013-03-04 12:58 ` [PATCH -v3 23/23] remove unused random32() and srandom32() Akinobu Mita
22 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm; +Cc: Akinobu Mita, David S. Miller, netdev
Commit 496f2f93b1cc286f5a4f4f9acdc1e5314978683f ("random32: rename
random32 to prandom") renamed random32() and srandom32() to prandom_u32()
and prandom_seed() respectively.
net_random() and net_srandom() need to be redefined with prandom_* in
order to finish the naming transition.
While I'm at it, enclose macro argument of net_srandom() with parenthesis.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
---
No change from v2
include/linux/net.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/net.h b/include/linux/net.h
index aa16731..99c9f0c 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -240,8 +240,8 @@ do { \
#define net_dbg_ratelimited(fmt, ...) \
net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
-#define net_random() random32()
-#define net_srandom(seed) srandom32((__force u32)seed)
+#define net_random() prandom_u32()
+#define net_srandom(seed) prandom_seed((__force u32)(seed))
extern int kernel_sendmsg(struct socket *sock, struct msghdr *msg,
struct kvec *vec, size_t num, size_t len);
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH -v3 23/23] remove unused random32() and srandom32()
2013-03-04 12:58 [PATCH -v3 00/23] rename random32 to prandom Akinobu Mita
` (21 preceding siblings ...)
2013-03-04 12:58 ` [PATCH -v3 22/23] net: rename random32 to prandom Akinobu Mita
@ 2013-03-04 12:58 ` Akinobu Mita
22 siblings, 0 replies; 35+ messages in thread
From: Akinobu Mita @ 2013-03-04 12:58 UTC (permalink / raw)
To: linux-kernel, akpm; +Cc: Akinobu Mita, Theodore Ts'o
After finishing a naming transition, remove unused backward
compatibility wrapper macros
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
---
No change from v2
include/linux/random.h | 7 -------
1 file changed, 7 deletions(-)
diff --git a/include/linux/random.h b/include/linux/random.h
index 347ce55..3b9377d 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -29,13 +29,6 @@ u32 prandom_u32(void);
void prandom_bytes(void *buf, int nbytes);
void prandom_seed(u32 seed);
-/*
- * These macros are preserved for backward compatibility and should be
- * removed as soon as a transition is finished.
- */
-#define random32() prandom_u32()
-#define srandom32(seed) prandom_seed(seed)
-
u32 prandom_u32_state(struct rnd_state *);
void prandom_bytes_state(struct rnd_state *state, void *buf, int nbytes);
--
1.8.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread