aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/hamradio/baycom_epp.c13
-rw-r--r--drivers/net/hamradio/hdlcdrv.c13
-rw-r--r--drivers/net/hamradio/yam.c11
3 files changed, 6 insertions, 31 deletions
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
index 153b6dc80af4..84aa2117c0ee 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -52,6 +52,7 @@
52#include <linux/hdlcdrv.h> 52#include <linux/hdlcdrv.h>
53#include <linux/baycom.h> 53#include <linux/baycom.h>
54#include <linux/jiffies.h> 54#include <linux/jiffies.h>
55#include <linux/random.h>
55#include <net/ax25.h> 56#include <net/ax25.h>
56#include <asm/uaccess.h> 57#include <asm/uaccess.h>
57 58
@@ -433,16 +434,6 @@ static void encode_hdlc(struct baycom_state *bc)
433 434
434/* ---------------------------------------------------------------------- */ 435/* ---------------------------------------------------------------------- */
435 436
436static unsigned short random_seed;
437
438static inline unsigned short random_num(void)
439{
440 random_seed = 28629 * random_seed + 157;
441 return random_seed;
442}
443
444/* ---------------------------------------------------------------------- */
445
446static int transmit(struct baycom_state *bc, int cnt, unsigned char stat) 437static int transmit(struct baycom_state *bc, int cnt, unsigned char stat)
447{ 438{
448 struct parport *pp = bc->pdev->port; 439 struct parport *pp = bc->pdev->port;
@@ -464,7 +455,7 @@ static int transmit(struct baycom_state *bc, int cnt, unsigned char stat)
464 if ((--bc->hdlctx.slotcnt) > 0) 455 if ((--bc->hdlctx.slotcnt) > 0)
465 return 0; 456 return 0;
466 bc->hdlctx.slotcnt = bc->ch_params.slottime; 457 bc->hdlctx.slotcnt = bc->ch_params.slottime;
467 if ((random_num() % 256) > bc->ch_params.ppersist) 458 if ((random32() % 256) > bc->ch_params.ppersist)
468 return 0; 459 return 0;
469 } 460 }
470 } 461 }
diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c
index 452873e7c68f..f5a17ad9d3d6 100644
--- a/drivers/net/hamradio/hdlcdrv.c
+++ b/drivers/net/hamradio/hdlcdrv.c
@@ -56,6 +56,7 @@
56#include <linux/if_arp.h> 56#include <linux/if_arp.h>
57#include <linux/skbuff.h> 57#include <linux/skbuff.h>
58#include <linux/hdlcdrv.h> 58#include <linux/hdlcdrv.h>
59#include <linux/random.h>
59#include <net/ax25.h> 60#include <net/ax25.h>
60#include <asm/uaccess.h> 61#include <asm/uaccess.h>
61 62
@@ -371,16 +372,6 @@ static void start_tx(struct net_device *dev, struct hdlcdrv_state *s)
371 372
372/* ---------------------------------------------------------------------- */ 373/* ---------------------------------------------------------------------- */
373 374
374static unsigned short random_seed;
375
376static inline unsigned short random_num(void)
377{
378 random_seed = 28629 * random_seed + 157;
379 return random_seed;
380}
381
382/* ---------------------------------------------------------------------- */
383
384void hdlcdrv_arbitrate(struct net_device *dev, struct hdlcdrv_state *s) 375void hdlcdrv_arbitrate(struct net_device *dev, struct hdlcdrv_state *s)
385{ 376{
386 if (!s || s->magic != HDLCDRV_MAGIC || s->hdlctx.ptt || !s->skb) 377 if (!s || s->magic != HDLCDRV_MAGIC || s->hdlctx.ptt || !s->skb)
@@ -396,7 +387,7 @@ void hdlcdrv_arbitrate(struct net_device *dev, struct hdlcdrv_state *s)
396 if ((--s->hdlctx.slotcnt) > 0) 387 if ((--s->hdlctx.slotcnt) > 0)
397 return; 388 return;
398 s->hdlctx.slotcnt = s->ch_params.slottime; 389 s->hdlctx.slotcnt = s->ch_params.slottime;
399 if ((random_num() % 256) > s->ch_params.ppersist) 390 if ((random32() % 256) > s->ch_params.ppersist)
400 return; 391 return;
401 start_tx(dev, s); 392 start_tx(dev, s);
402} 393}
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index 08f27119a807..ee3ea4fa729f 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -50,6 +50,7 @@
50#include <linux/slab.h> 50#include <linux/slab.h>
51#include <linux/errno.h> 51#include <linux/errno.h>
52#include <linux/bitops.h> 52#include <linux/bitops.h>
53#include <linux/random.h>
53#include <asm/io.h> 54#include <asm/io.h>
54#include <asm/system.h> 55#include <asm/system.h>
55#include <linux/interrupt.h> 56#include <linux/interrupt.h>
@@ -566,14 +567,6 @@ static void yam_start_tx(struct net_device *dev, struct yam_port *yp)
566 ptt_on(dev); 567 ptt_on(dev);
567} 568}
568 569
569static unsigned short random_seed;
570
571static inline unsigned short random_num(void)
572{
573 random_seed = 28629 * random_seed + 157;
574 return random_seed;
575}
576
577static void yam_arbitrate(struct net_device *dev) 570static void yam_arbitrate(struct net_device *dev)
578{ 571{
579 struct yam_port *yp = netdev_priv(dev); 572 struct yam_port *yp = netdev_priv(dev);
@@ -600,7 +593,7 @@ static void yam_arbitrate(struct net_device *dev)
600 yp->slotcnt = yp->slot / 10; 593 yp->slotcnt = yp->slot / 10;
601 594
602 /* is random > persist ? */ 595 /* is random > persist ? */
603 if ((random_num() % 256) > yp->pers) 596 if ((random32() % 256) > yp->pers)
604 return; 597 return;
605 598
606 yam_start_tx(dev, yp); 599 yam_start_tx(dev, yp);